3 ms·
On the one hand, yes, or as Sandi Metz put it, “duplication is better than the wrong abstraction.” On the other hand it is often possible to refactor and restr
by inopinatus 6y ago
On the one hand, yes, or as Sandi Metz put it, “duplication is better than the wrong abstraction.”
On the other hand it is often possible to refactor and restructure code such that you no longer have to name something. Returning a closure rather than a value, or folding over a list, are two of my favourites approaches, since in many languages you then deal with the object symbolically, or implicitly through syntax, rather than explicitly or by named reference. Coroutines, continuations, and generators too.