3 ms·
Delegation is the right way to go. Containment hierarchies is a nice way to phrase it. Roman numerals had fervent defenders back in the day. You can use OOP in
by foobar_ 6y ago
Delegation is the right way to go. Containment hierarchies is a nice way to phrase it. Roman numerals had fervent defenders back in the day. You can use OOP in a sane way if
1. You avoid extends at all costs (avoid inheritance)
2. All classes are declared final, implement one or more interfaces ( you get polymorphism and abstraction)
3. Split data and code and use immutable data or declare all data as private with no public getters and setters (more encapsulation)
4. Ignore anything ever said by OO thinkers and architects because they will eventually ask you to do the above three with a domain specific language in 30,000 words
- x0hm 6y agoThis is pretty accurate. I'd also throw in "Don't use static functions" and "Write declarative code". Honestly, I think getting rid of public getters and setters goes a LONG way toward more reasonable objects.