Why Use Object-Oriented Programming?6:02 with Alena Holligan
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.
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.
- Sooner rather than later, you’ll have to work with object-oriented code.
- 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.
You need to sign up for Treehouse in order to download course files.Sign up