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

OOP is great as long as your inheritance stack is at most 2 classes deep: abstract base classes for different backend implementations, or for holding heterogeneous objects like a syntax tree or, idk, inodes in the kernel, or even just one actual implementation and additional implementations for tests. At which point you may as well call the base class an interface.

Can't think of any sensible 3+ classes deep hierarchy that I've seen in a sensible project. I've seen some that are not sensible.




Most modern code bases I've seen only use interfaces now. Only in the odd exception do they use inheritance.




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

Search: