3 ms·
Usually abstraction adds LOC
by throwaway415415 8y ago
Usually abstraction adds LOC
- darawk 8y agoIf abstraction adds LOC on net to your project, you're doing it wrong.
- svat 8y agoIn the very example in the OP, the abstraction adds lines of code: function calls, function signatures, possibly return statements. I think many programmers associate abstraction with having less code (which is almost always good, under reasonable circumstances of course), and this translations into a love of abstraction even in cases where it doesn't simplify things or lead to less code.
- speedplane 8y agoAbstractions should reduce complexity, which often correlates to LOC, but is not necessarily so.
- darawk 8y agoYa, but that's because the abstraction in the OP isn't complete. It's showing the abstraction of a single instance of a subproblem, for clarity. But real abstraction generally abstracts multiple instances of a subproblem (or at least, it should), and thereby reduces LOC.