Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Kevin Smith:
What's So Great About OOP?
Jul 12, 2018 @ 10:28:48

In a post to his site Kevin Smith wonders "what's so great about OOP?". In it, he goes back to the basics of OOP (object-oriented programming) and keeps it simple, avoiding more advanced OOP-related topics.

One of my core responsibilities as a senior software engineer is mentoring the junior engineers and interns at work. [...] Recently a question came up with our new interns while talking through the design of a feature: What is object-oriented programming? How is it different from what we're doing now, and why should we write code that way?

I wanted to find a fundamental explanation to send them for later, but nearly everything I came across immediately jumped into SOLID or design patterns or advanced concepts of some kind.

He starts from the beginning, where most PHP developers cut their teeth with the language: procedural programming. He provides some (non-OOP) examples of this, making use of simpler functions rather than objects and methods. He then moves on to compare this with OOP. He talks about how it's more than just a different syntax (a shift in thinking really). He refactors his previous example to use objects and methods. He finishes up the post answering one of his original questions: what's the real benefit of OOP over procedural programming.

tagged: oop objectorientedprogramming tutorial introduction procedural difference

Link: https://kevinsmith.io/whats-so-great-about-oop