Let’s talk about OOP is not. When you look at different plugins in WordPress, you’ll see a common pattern of class blueprint with all static properties and methods. That is not OOP. Why? You can’t create an object from statics. Statics don’t know anything about objects, as they belong to the class. This episode will show you why this matters.
The design approach of wrapping static functions and properties within a class is called Class Wrapper. It’s a design pattern that utilizes the class’ ability to hide complexity. When used for that purpose, it can add helper functionality to your plugin or API. But don’t get confused, as it is not OOP.
A class that is all static properties and methods is not OOP. It’s a design pattern to wrap up like functionality while utilizing the class’ ability to hide complexity.
To view the rest of this write-up, please log in or Go Pro.
You will grow in this profession when you incrementally and systematically stretch yourself....bit-by-bit.
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