ClassicPress Plugin Development: Coding Paradigms

ClassicPress PluginsThis post is part of the ClassicPress Plugin Development series.

There are two code paradigms that can be used when developing for ClassicPress:

  • Procedural Programming
  • Object Oriented Programming

There has been many a flame war fought over which is better and which is worse, but in all honesty I believe that both can have their place and there is no one true way of coding.

I was going to cover the differences between the two types, but when I was researching for good definitions I came across an article by Tom McFarlin linking to articles he and Stephen Harris wrote on the coding paradigms which can be used with WordPress, and therefore ClassicPress, plugins.

I am not that old, but my programming career (short as it was and now a few years in the past after I moved into being a consultant) tended to be with older languages such as Pick Databasic and Visual Basic; I also self-taught myself Lua and later PHP.

In all of the programming/scripting languages I have worked with professionally, to any great extent, the code has been procedural; I'm not saying all of these languages are only procedural, just that virtually all of the code I worked with was written as procedural. As such I am far happier in a procedural world and so I have used this for writing my plugins. At least where I can; plugins with widgets are the exception as ClassicPress require the widget elements to be object orientated.

How you choose to develop for ClassicPress is exactly that; your choice. The examples I will be posted will, except when talking about widgets, be procedural code.