Hacker News new | ask | show | jobs
by dagw 1161 days ago
why would it be hard to write methods that only do one thing?

Two big problems with this approach. First of all reasonable people can disagree on what "one thing" actually means. Let's say you want to take a csv file of numbers and return a numeric array-of-arrays. How many 'things' is that, 1 or 4 (read, parse, validate, convert)?

Secondly it is many time both computationally more efficient and 'aesthetic' to do everything in one in-line sweep rather than:

  x=f(x)
  x=g(x)
  x=h(x)
  ...
While both approaches can be taken to extremes, I generally agree with what John Carmack wrote on the topic many years ago http://number-none.com/blow/blog/programming/2014/09/26/carm...