Hacker News new | ask | show | jobs
by davnicwil 3222 days ago
I think the short functions thing is a funny one. The benefits of short functions are definitely praised in the book, but they are really more of a side effect of the real goal: to have pieces of logic that do one single thing that can be summed up in a function name and understood as a clear input -> output 'step' at the level of abstraction above, without having to dig in to find out 'how it works' or understand any weird quirks / unexpected side effects etc.

Usually, by their nature, such functions don't end up being very long. This is great, but it remains just a nice side effect of the real goal, and one that is not more important than the real goal. To artificially break up a slightly longer function which is very focused in its behaviour, just for the sake of line count, is probably a mistake.

To be honest, I can't remember how clearly the book makes this distinction, or if it does at all, but I feel like it probably could be made clearer given how common this misinterpretation is.