News for hackers. Stuff that matters.
Re:Linear code is more readable by roelschroeven on Friday September 15, 2023 @08:43AM (#37522102)
> The key insight on why giant linear functions are often more readable (and desirable) is because they allow you to keep more concepts/relationships simultaneously together as a single chunk without context switching which seems to aid our comprehension.

The problem with giant linear functions is that those concepts get separated by sometimes thousands of lines. Separating out the high-level concepts vs the nitty-gritty details, putting the latter in functions that then get called to implement the high-level concepts, does in my experience in most cases a better job of keeping related things together.

Re:Linear code is more readable by rramadass on Friday September 15, 2023 @09:41AM (#37522801)
See my other comment here : https://news.ycombinator.com/item?id=37522577

The issue is one of Policy vs. Mechanism - https://en.wikipedia.org/wiki/Separation_of_mechanism_and_po...

It is "Mechanism" which should be separated out and encapsulated while "Policy" (aka business logic) is what is better centralized as a linear (possibly large) function.