News for hackers. Stuff that matters.
Re:Small functions considered harmful by jdmichal on Friday August 11, 2017 @11:24AM (#14990587)
I think it's more likely that your "great programmers" simply understand the difference between the same functionality and accidentally similar functionality. The latter is where you have two use cases that are very similar, so you spend all this time deduplicating. Then one of the use cases changes... The correct response would be to duplicate the code again, because the two use cases are no longer similar. In reality, they should have never been combined in the first case. They weren't the same; they were only accidentally similar.

But instead what you usually see is minor tweaks to the common functions. Pass in a flag here, tweak the inputs there, add an if statement over yonder... And before you know it, it's all a terrible tangled mess that is full of branches and technical debt. The two use cases have the same functions, but don't even follow the same branches within the functions.

Re:Small functions considered harmful by dllthomas on Friday August 11, 2017 @01:52PM (#14992496)
Yeah, I've been saying that removing accidental similarity isn't improving code but compressing it. "Huffman coding", if you will...
Re:Small functions considered harmful by jacobush on Saturday August 12, 2017 @05:34AM (#14997213)
Thank you for putting that into words, and rather few too. I have only felt that anti-pattern before, not had words for it. Does it have a name? If not, we should give it a name!
Re:Small functions considered harmful by whack on Thursday August 17, 2017 @08:39AM (#15036167)
I believe this pattern is referred to as accidental-duplication. Some existing discussions on this:

https://softwareengineering.stackexchange.com/questions/3000...

http://www.informit.com/articles/article.aspx?p=1313447