4 ms·
> However, if you take it to the extreme (composition only, never inheritance) you sometimes end up with really weird meaningless objects that have only a singl
by tadfisher 1y ago
> However, if you take it to the extreme (composition only, never inheritance) you sometimes end up with really weird meaningless objects that have only a single method and a one-to-one relationship with another object.
We can take a cue from the functional languages and make this less code-smelly by using anonymous function types (e.g. lambdas). This removes the one issue with single-purpose/single-method objects, which is naming them.
- alganet 1y agoIt's an extra tool, for sure. There is no silver bullet. No one likes huge inheritance chains, no one likes only tiny lego pieces, no one likes callback hell.