Hacker News new | past | comments | ask | show | jobs | submit login

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.




Applications are open for YC Winter 2021

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: