5 ms·
After a previous discussion here it seems people confuse classes with modules. At the risk of repeating myself. Class based inheritance - Bad Traits, roles, m
by foobar_ 6y ago
After a previous discussion here it seems people confuse classes with modules. At the risk of repeating myself.
Class based inheritance - Bad
Traits, roles, mixins - You are still thinking in terms of inheritance so its Meh.
Combining Data and Code - Slow.
Closures, Functors - Cool ... classes with single methods are as "single responsibility" you can get.
Interface Inheritance - Go / protocols from clojure - Better
Interfaces without inheritance - Modules - Best ... the way software is meant to be written. This is the reason why APIs, libraries are so reusable. Modules are like contracts for the function call interface. Because of this you also get the ability to load plugins as opposed to the whole dependency injection.