Practical Object-Oriented Programming for WordPress Developers: A Tutorial Series

Goals of this Tutorial

Welcome to this ongoing series whose goal is to teach Object Oriented Programming to WordPress developers.

This series will teach you in a unique manner compared to traditional tutorials on OOP and based on my several decades of instructional experience. Using this approach it I believe it will be easier for a WordPress developer to learn OOP than from most other tutorials on the topic.

Not only will you learn OOP you will also learn many practical techniques you can apply to your projects immediately, something else that most OOP tutorials I have seen do not provide.

Table of Contents/Installments

Here are the installments of this series I have written thus far, and the name of the next one planned:

  1. Understanding objects in PHP for WordPress
  2. A review of WordPress’ built-in classes

But is this Practical OOP series for me?

You build WordPress sites, themes and/or plugins for customers, clients, your employer and/or yourself.  You are at least somewhat comfortable with PHP coding but still do not really understand “Object-Oriented Programming.” That said, you have been told by countless other developers that you should be programming this way.   But try as you might,  you have struggled to learn what we programmers call OOP, for whatever reason. Maybe its confusing tutorials, or maybe it’s just a lack of time. Whatever the case, you are still not there yet.

Is this you?  Essentially a skilled WordPress “developer” but still a beginner when it comes to Object Oriented Programming?

If yes then you are the audience I envision for this series of installments. I  designed this series to bring you up to speed on OOP for WordPress painlessly and easily while providing you with real world code you can put into practice immediately.

But if you are a fairly experienced programmer then the first few installments will almost certainly be too simple for you. But if you are not yet at guru status it will still be best to wait until for the 3rd or later installments of this series.

On the other hand if you are an OOP for WordPress guru you can of course skip the entire series. 🙂

Why is OOP so hard to learn?

Skip this section to jump ahead to installment 1 and start learning OOP right away.  

We could ponder at least why so many have struggled with OOP. But instead I would like to suggest that learning OOP can be hard because almost every tutorial that attempts to teach it starts with the what of Object-Oriented Programming before it ever makes the case for why you should use OOP.

Chances are you have read tutorials on OOP and they quickly tell you that OOP is a coding style and that it differs from procedural programming. Then they quickly rattle off how OOP requires encapsulation, abstraction, inheritance and polymorphism long before the expose you to the programming problems that OOP can solve.

These tutorials either use abstract examples that don’t apply to WordPress, or their examples as so overly complex that you do not learn how to use OOP in the practical ways you need need to solve problems today. Given this is it no wonder that so many people struggle with or fail to appreciate the practical benefits of OOPs. Instead OOP just starts feeling like a bunch of rules presented as unquestionable programming dogma something that only the most pedantic can warm up to.

I know. I started my professional career as a programming trainer and that is exactly how I taught OOP at the time. I was religious about it at the time. The OOP books at the time and my college professors who taught OOP always started with the what, never with the why or the practical how so at first I emulated them.

But since those early days several decades ago I learned people struggle when concepts are presented ahead of why they matter. I learned this when I found myself struggling with new concepts when I have yet to understand the problems they solve.

So that is how this series intends to differ; I first want to give you a reason to care before I indoctrinate you with OOP jargon.

Without further adieu, let us dive in.