Developing Class-Based Plugins
Now that we've defined object-oriented programming and explored just enough to lay a foundation, it's time to actually begin talking about the components of OOP-based development in the context of WordPress plugins.
Throughout the rest of this article, we're going to cover the basics of what's required for writing OOP-based plugins, and the advantages that it brings.
Defining the Class
Before you do anything in object-oriented development, you have to define your class. Assuming that you already have an idea as to what your class is going to do, this generally a matter of coming up with what you want to name your class.
For the most part, I think that viewing example code is always advantageous when actually teaching code, so we'll be taking a look at the WordPress Plugin Boilerplate.
Note that the Plugin Boilerplate is a project that I originally created to help jumpstart OOP-based plugins. It's since been contributed to by a number of different people. I'm using it in this article because it demonstrates the topic at hand.