Re:Low Hanging Fruit of Programming Language Design
by always_good on Wednesday November 22, 2017 @12:21PM
(#15758529)
You DRY up code by writing indirection. That's the expense of all abstractions. You can't believe that all indirection is worth it at all costs, so I'm not sure what point you're belaboring.
[ Parent
| on HN ]
Re:Low Hanging Fruit of Programming Language Design
by naasking on Wednesday November 22, 2017 @02:16PM
(#15759581)
> You can't believe that all indirection is worth it at all costs
I think I've been pretty clear about the costs and when this is worth it, particularly in my first post in this subthread, which I'll quote here:
> That said, the moment you have to start adding parameters in order to successfully factor out common code, ie. to select the correct code path taken depending on caller context, that's when you should seriously question whether the code should actually be shared between these two callers. More than likely in this case, only the common code path between two callers should be shared.
Or if you want a more concise soundbite: refactor if your indirection is actually a clear and coherent abstraction.