As a front-end developer, most of my back-end experience has come from developing WordPress sites. In fact, the first back-end language that I “learned” was PHP, and even that was just enough to develop WordPress.
For the past few months, I’ve been experimenting with back-end languages a little bit, building (very simple) apps using first Laravel, then a little bit of Python, and finally NodeJS. I’m sure that there are some developers out there that are looking to take the leap from WordPress development to proper back-end development. As I’m starting to get more and more involved with these languages, I thought it might be helpful to share the transition for those looking to take the leap.
What We Can Learn From WordPress
At first, I thought the transition would be fairly smooth. After all, I’d been writing PHP for 5 years while developing WordPress sites. It turns out that’s not quite the case. When you’re developing for WordPress, what you’re actually doing is interacting with an extremely well structured and extensive API. In other words, WordPress does a lot of the legwork before you get to it.
Still, that doesn’t mean you’ll be starting from scratch. WordPress is a great way to learn the fundamentals. You learn about functions and variables, methods, classes, and the basic building blocks of code. You learn proper code syntax, scope and basic structure principles. You might not know what anything is called, but you’ll have a good understanding of it. At the very least, you can pat yourself on the back and breeze through the first few chapters of any how-to manual.
You’ll also be comfortable with the command line, which will come in handy. But there’s one skill that I’m sure you’ve acquired that is sometimes undervalued: debugging. Anyone who’s been met by the white screen of death knows how to work backwards through code, isolate a piece of functionality and tweak until fixed. This will be invaluable as you begin your path down server side programming.
Of course, the path won’t be all paved with gold. You will have to start thinking about programming a bit differently.
From Functional Programming to Beyond
The most basic kind of development work that you’ll do with WordPress is most likely a form of what’s called “functional programming.” This means that your code structure is dependent on setting up a string of functions, and passing parameters through them. This typically means that functions perform just one action and return a result. It also means that variables are set globally. For the most straightforward example of this, simply pop open your average functions.php file. You will notice that as the code flows, each function executes a very specific task, then moves on.
If you decide to branch outside of WordPress it won’t be long until you come into contact with Object Oriented Programming. OOP is not technically superior, but it’s favored by a lot of developers and frameworks out there. With OOP, code is structured into classes, which group together related functions to be called on later. This confines variables to a tighter scope and introduces a whole new way of thinking about code. It means thinking about the structure of your code first, and being prepared to define everything first, and then build with it second. It will take a little while to get used to, and that’s okay. Luckily, you probably have a little experience with it. Plugin development tends to follow this model a little more, and if you’re looking for a good introduction / skeleton, then Tom McFarlin’s Plugin Boilerplate is a great example.
You might also come across the term MVC, which stands for Model, View, Controller. Again, this requires a bit of different thinking. The basic idea is that a user’s request for your site is routed through a Controller, which pulls in data from the Model and then passes it over to your View, which renders the template. What this means in practice is that data logic and view / template logic is kept separate, and can each operate independent of each other. It is the Controller’s job to link everything together. In WordPress you’ll write your loop and query parameters right into the template, but with a MVC framework, everything is divided. It makes sense quicker then you think, but you have to plan everything out, and you it can be a bit tricky to know how to group everything. Just remember, when in doubt, put it in your Controller (just kidding, kind of).
The reason for these different methods of programming is actually pretty simple. WordPress does a lot of the complicated stuff out of the box. Routing, URL writing, User authentication, Database connections, Data sanitization, etc. is all handled for you. By the time you, the developer, get to the platform, most of the logic is written already. Your role is simply to build on top of that. If you are moving into other back-end languages, you’ll have to create a lot of these things from scratch, or at the very least, one piece at a time. This makes for leaner code, but requires a lot more forward thinking.
Where to Start?
If you’ve been on the fence about learning something new in the back-end, I absolutely think it’s worth the try. Of course, there are lot of options out there to start with. Dozens of languages and hundreds of frameworks can be a bit overwhelming to find the right one. Well, there is no right one. You just have to play to your strengths.
If you’ve been working with WordPress for a long time, it might be a good idea to start with some sort of PHP app framework. I’ve become attached to Laravel, but CakePHP and CodeIgniter are both very good options. If you’re more of a front-end developer and proficient in Javascript, then NodeJS with the Express framework is becoming increasingly popular. If you really want to get outside your comfort zone, then Django or Ruby on Rails will be a better choice then jumping straight into Python or Ruby. Try to pick something that you’ve had a little experience with, so that you can get on your feet quicker.
These frameworks are built to ease you into the process, and often have specific configurations to follow and large communities to draw from. The best part is, once you learn the general principles of one framework or language, it becomes increasingly easier to move between them. The trick is to start somewhere. It’s what I’ve only begun to do, and I’m glad I did.
Feel free to share your experiences learning about back-end development in the comments section below!
Jay Hoffmann is a WordPress developer hailing from NYC. In the strictest sense of the word, he is a WordPress enthusiast with an eye for front-end development and design. He has been working with WordPress since 2006 and currently works for a popular children’s media company. This year, Jay started Tidy Repo, a curated list of the best and most reliable plugins from around the web. You can also follow Jay on Twitter.
7 Comments