DEV Community


Discussion on: PHP is bad for Object-Oriented Programming OOP

aleksikauppila profile image
Aleksi Kauppila • Edited

Hi Jorge, thanks for posting! Whew. There's a lot going in this piece. I wasn't unfortunately able to link almost any of things raised in this article to the title. I'll go through a couple:

  • The main problem with OOP is not serialization. OOP is about putting data and behaviour that operates on that data to the same object. It's about encapsulation, inheritance and polymorphism. Good OOP can be written in Python, Javascript and PHP. PHP however uses a lot global functions and primitive data types, but you still can navigate through the issues it has with relative ease.

  • What Laravel calls a model is in fact a very standard name in almost all frameworks that advertise themselves as MVC architecture frameworks. The pattern used here is called Active Record. See for example Django, FuelPHP, PropelORM, CakePHP, Ruby on Rails etc.