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

I get this question sometimes from a developer new to my team asking if it’s ok to add OOP code since most of the existing code is just functions.

My view on that is that it’s ok to use OOP and define classes if you are really defining an OOP style object. Back in the 90s is was taught that an object has identify, state and behaviour. So you you don’t have all three, it’s not really an object in the OOP style.

Looking at it through this lens helps make it clearer when you should add classes or just stick to function and closures.



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

Search: