Tag Archives: Polymorphism

Polymorphism and WordPress: Interfaces

Let’s talk about interfaces. As a WordPress developer, how can they be useful to you and your projects? It’s going to be a tough sell because WordPress core doesn’t use them and we’ll see why this is an issue a bit later. That said, you’ll still find this article useful if you’re looking to:

  • Learn more about PHP and not just WordPress
  • Build strong and extensible PHP code
  • Reduce bugs in your open source plugins
  • Use open source PHP frameworks

Like the article on abstract classes, you’ll get a detailed example to help you with the topic. It’ll explain how interfaces work and how you can use them. You’ll also get a good idea of the design decisions that warrant the use of an interface.

Continue reading Polymorphism and WordPress: Interfaces

Polymorphism and WordPress: Abstract classes

When we covered inheritance, there were some questions about interfaces and abstract classes.

  • What can you use them for?
  • What are the advantages?
  • When should you use them?

These are all great questions that are worth exploring. As the title suggests, “Polymorphism” is the object-oriented feature that helps answer these questions. It’s not an easy feature to grasp.

That’s why most of the article will be about an in-depth example. You’ll see the thought process involved with using it. This will help you understand it better so you can apply it to your own projects.

Continue reading Polymorphism and WordPress: Abstract classes