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

The open-closed principle involves creating classes that _never_ change in the future. If you want to extend their behaviour you should subclass them. This makes some sense in a codebase with no tests, the risk of change becomes too high. But then who codes without tests these days? Given that you should always be writing tests for your code I think this principle should probably be left in the history books. It seems like a great way to add unnecessary complexity to your code base.


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

Search: