3 ms·
Great point, and agree that generalization makes for the clearest wins from abstraction. But there are also cases where there is no generalization, but the enc
by highfrequency 2y ago
Great point, and agree that generalization makes for the clearest wins from abstraction.
But there are also cases where there is no generalization, but the encapsulation / detail hiding is worthwhile. If you have a big function and in the middle of it you need to sort some numbers, you would probably implement a Sort routine to make the control flow much easier to understand - even if you only use the function once (let’s pretend there’s no sort functionality in standard library).
Curious if others agree, and what heuristics you use to decide when implementation encapsulation is worthwhile.