Hacker News new | ask | show | jobs
by ronbo 4189 days ago
still i would like to see a concrete example where OOP is better. I thought that OOP had advantages in larger projects with many kinds of data where it helped organize the code to make it more readable and editable. At that point you need to be careful how you use it to make it manageable. Not sure how small an example would could be before it started to show some benefits.
1 comments

The encapsulation that guarantees invariants is the greatest benefit. This can be Done in another way by immutable structures and Functional programming. This way is in many ways better than OO but both are vastly superior to having publicly mutable structures modified by procedures.

Semantic organization where methods are defined near the data (the recepie is on the flour package) is a benefit for sure, but it's just a preference.