4 ms·
>So in general I am not convinced by how the title and intro of the article put it. If we look at the article, the title is also actually different than here. I
by tziki 6y ago
>So in general I am not convinced by how the title and intro of the article put it. If we look at the article, the title is also actually different than here. It says "Very short [...]" not "short".
The "very" word was automatically stripped by hackernews. I'm guessing some system to tune down clickbait posts?
>By not using small functions, one gives away readability as well. Every function is a chance to give a name to some short program. Short functions can be looked at separately, if written well. Of course, if you modify a lot of global state in your short function then no one can help you any longer.
I disagree about readability - I think the empirical experiments show enough evidence about short functions not being more readable than long functions, that we can't take that as granted.
For reusability, you might be right, and maybe that's why short functions did seem to perform better when modifying existing functionality.
>Well, that happens usually, when the naming is off or difficult to remember or follow. That is why naming things is an incredibly important skill. The name of a function should, if possible, give a good picture (by convention if there is any) of what the function is doing. Do not tell me, that the 100 loc function can be described in a single verb. It is most likely doing much more than one thing.
Sure, but naming things well is also a difficult skill, which means not everyone can do it well. If we look at programming as a worldwide phenomenon, the vast majority of programming is done in English. However, the majority of programmers aren't native speakers, meaning they face an even steeper climb to become good at naming things. There will always be cases where programmers misname functions, or don't update the name when changing functionality, or typo, and I think the data here shows that things like that do happen.
>I would like to see the same research being done on a language like Haskell or Scheme, one language at a time.
I do agree that all the research focuses on mainstream languages, and the results might be different for functional languages. However, the point of this post is to look at science and there's simply no science there. There aren't any bug datasets focusing on functional languages either.
The point of this post is to gather what we know about function length and what we don't. I feel you've pointed at many of the areas we don't know much about - and maybe we'll get there one day. However, for now, we need to look at what we know and what kind of generalizations we can make from what we currently know.
- jghn 6y ago> I think the empirical experiments show enough evidence about short functions not being more readable than long functions, that we can't take that as granted. Pure anecdata on my part, my observation over the years is that developers tend to cluster on this cluster with high correlation to if they're a top down or bottom up thinker when it comes to coding in that top down devs tend towards smaller functions and bottom up devs tend towards larger functions. If there is in any validity to my anecdata, my hypothesis has been that the top down/smaller function crowd is more likely to trust underlying implementation of sub-functions for one reason or another, while the bottom up/larger function crowd wants to be able to visually verify how things work.