4 ms·
Ruby does have language features for composition, and “composition over inheritance” has popped up in the community. I have also looked into the use of traits i
by hosh 9mo ago
Ruby does have language features for composition, and “composition over inheritance” has popped up in the community. I have also looked into the use of traits in Smalltalk.
- lloeki 9mo agoAbsolutely, usage of inheritance is (comparatively to Java/C++/Python) quite rare in Ruby. People favour modules to compose (e.g Enumerable), and more generally interfaces (e.g duck-typed StringIO vs IO/File/etc...) If you throw in RBS and start to type Ruby things then you start to see that Go-style interfaces pop up quite frequently.