What is Object-Oriented Programming (OOP)?
Lab: Introduction to PHP Object-Oriented Programming (OOP) for WordPress
Video Runtime: 14:14
The acronym OOP stands for object-oriented programming. OOP is a programming paradigm, meaning it’s another approach for how you architect and build code. OOP is programming that is oriented to (focused on) objects. It seeks to emulate the real world.
What does that mean? Let’s relate this concept to the objects you know.
Look around your office. Grab an ink pen. Now, look at it. An ink pen is mass-produced from a blueprint. Millions of ink pens were made just like yours. Each pen has characteristics, such as the color of the ink, cap or click, body color, and size. It has behavior. You click on it and the tip extends out. You write with it and the ink is dispensed out onto the paper or medium.
How about your car. It’s an object too. Cars are mass-produced by car manufacturers from a blueprint. They have behavior, such as they start, move forward, move backward, stop, etc. They have characteristics, such as body color, interior type, the number of doors, and more.
Do I need to write code in OOP?
No. You can write code in procedural, functional, or OOP. The choice is yours. WordPress is built on procedural. There are some OOP implementations. Some plugins are built in static function wrappers while others are in OOP.
You don’t need to write OOP. However, it can be very helpful in your career to learn it.
Why learn OOP
If you want to grow in this profession, learning OOP will help. Outside of WordPress, OOP is popular. If you want to build in Laravel, Symfony, Zend, RoR, Drupal, and others, then you’ll need a solid mastery of OOP.
Learning OOP will help you to read and adapt more code. You’ll be able to go to other repositories and see how others are solving problems. You can bring those techniques and solutions back to your projects, adapt them, and make your sites better.
Code. Eat. Code. Sleep. Dream about Code. Code.
Episodes
Total Lab Runtime: 03:04:55
- 1 Lab Introductionfree 08:27
- 2 What is Object-Oriented Programming (OOP)?free 14:14
- 3 What is an object?free 13:30
- 4 Meet the Class Blueprintpro 04:53
- 5 Creating an Objectpro 07:57
- 6 Defining Characteristicspro 10:54
- 7 Putting the Object to Workpro 13:56
- 8 Hiding Away the Complexitypro 22:40
- 9 Working within the Object with $thispro 15:41
- 10 Internal Control of Object Creationpro 15:07
- 11 Class Constantspro 08:58
- 12 Class Staticpro 17:49
- 13 What OOP is Notpro 19:11
- 14 Practical Examplespro 04:52
- 15 Wrap it Uppro 06:46