This course will be retired on June 1, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Ok, you probably already know you should learn OOP, but in this video we’ll introduce you to some of the things you’ll be able to do once you understand OOP and how that can help you to become a better developer.
Clarification
A programming paradigm is a style, or “way”, of approaching a problem to come up with a solution. The two main paradigms in PHP are procedural and object-oriented.
No one programming paradigm solves every programming problems, but the more you know about different paradigms, the better prepared you’ll be to choose the right tool for the job, and write cleaner and more organized code.
Bad / “spaghetti code” that weaves all over your application and is complicated to follow, can be written in any paradigm, including OOP.
Tenets of Object-Oriented Programming
The DRY principal or Don’t Repeat Yourself. When you repeat the same code in multiple locations, updating becomes a nightmare. Maximize reusability, minimize repeating code.
The KISS principle: Keep It Simple Stupid. Don't use fancy OOP features just because you can. Use fancy OOP features because they have specific, demonstrable benefits to the problem you're trying to solve.
The Why
- Sooner rather than later, you’ll have to work with object-oriented code.
- Modularity
- Scalability
- Frameworks
- Contributing to open source software.
- Gives you various ways to think and solve problems.
- More easily translate your programming skills into other Object-Oriented languages.
- Become a more valuable developer.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up