Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes! It's amazingly hard to do inheritance right. As a rule of thumb, if you can't prove that the inheritance doesn't violate the Liskov substitution principle, you shouldn't be allowed to do it. (It amazes me how many java 'programmers' have never heard of lsp or a refinement proof).


Ironically, Liskov is the exact opposite of how people do OOP. Most people subclass to add restrictions, where Liskov suggests that subtypes should relax restrictions.

This means your programs work better, but you have to plan ahead.




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

Search: