I ❤️ composition
I ❤️ composition.
There are many composition tools:
Functions
Classes
Components
Libraries
Packages
Composition avoids overwhelm and duplication by composing simple, atomic, reusable pieces.
The composition mindset: Solve big problems with simple solutions.
Composition is why I'm such a huge fan of JavaScript components (Whether React, Vue, Angular, Svelte, etc).
Same with pure functions. Same with npm packages.
Basic composition tools mean I can trust someone else's hard work and focus on the business problem instead. 👍
Oh, and yes, it's possible (though rare) to take composition too far.
For example, left-pad: https://theregister.com/2016/03/23/npm_left_pad_chaos/
To avoid overusing composition, consider the Fairbairn threshold: https://wiki.haskell.org/Fairbairn_threshold#:~:text=From%20HaskellWiki-,Fairbairn%20Threshold,common%20use%20several%20years%20ago