News for hackers. Stuff that matters.
Re:The Cost of Abstraction (2016) by taneq on Sunday February 24, 2019 @09:16AM (#19238624)
> What is the sweet spot? There must be an answer

Keep things 'square'. This is a fuzzy concept and I don't really know how to explain it properly, other than that the effort spent on each layer of abstraction should be roughly equivalent.

Your example is a single 1m-line function or 1m one-line functions. In this case you probably want 100 functions of 100 lines each (and yes, refactoring like this you probably save 100-fold in overall LoC so it works out.) And your 100 functions are probably nested in a 10-deep hierarchy where they all do roughly the same amount of cognitive work.

There are no comments on this comment yet.