DEV Community

Tim Nash
Tim Nash

Posted on • Originally published at timnash.co.uk on

Five languages for WordPress Developers to learn in 2020

This post was originally posted on TimNash.co.uk on 16th Jan 2020. Hi, I'm Tim, tend to talk about WordPress and Security on my site, I hope you enjoy this repost.

Folks often ask me questions, and recently there has been a little bit of interest in the fact that while I work in the WordPress space I’m not a traditional “WordPress Developer” and I don’t tend to work day to day with WordPress.

For those who don’t know me, my day to day programming is that of a backend and security engineer supporting WordPress developers and site owners. I work on infrastructure projects so I’m as likely to be playing with Linux kernels as WordPress code. This means I need a broad range of language familiarity and extensive knowledge of how to use Google.

However, if you are a WordPress Developer and you are looking for more backend languages to maybe play with then I present to you my choice of 5 languages you might consider focusing on in 2020.

Even if you have no real interest in other languages or learning a new language they have projects that are interesting and it’s worth at least understanding what some of the pros and cons of languages are.


Deep dive into PHP 7

Might seem an odd choice as someone thinking of themselves as a WordPress Developer probably knows PHP and its true. However with WordPress backwards compatibility has meant a great deal of stability that has made it the choice of 33% of the web it has also meant it’s codebase has stayed largely the same over the last few years. PHP has not, a once derided language is probably one of the most mature, community-orientated languages its development and growth along with careful (though some might disagree) cherry-picking features of other languages means the modern PHP developer has access to a language capable of a lot. It also provides an excellent gateway language for other languages in part because it is something of a hybrid language with features and broad concepts from other languages.

Pros

  • One of the best package managers in the form of Composer
  • Ubiquitous, getting up and running with PHP7.4 is easy and quick
  • As a WordPress developer you know PHP it’s about taking advantage of it’s features

Cons

  • Slower than many other languages, though massive improvements in PHP7+
  • Tutorials often written for older versions
  • Ubiquitous means much more variable packages

How do I use PHP?

Well outside of WordPress I primarily use the framework Laravel and it’s smaller Lumen framework to build API interfaces. While I don’t make extensive work with Laravel I have used it to build Chatbots for Facebook and Slack.

In addition I use CodeCeption as my Integration and acceptance test suite, often even if I’m using other languages.

I still reach for PHP if I’m interacting with the web or WordPress, this is made easier by WP-CLI.

Good Projects to follow

Outside of WordPress, PHP the right way is still considered one of the best resources out there to get going.

For frameworks, I would recommend looking at Laravel and if you are getting started with Laravel the excellent Laracasts is a great resource. Actually it’s a great resource for Javascript, React, Vue and dozens of other things too.

Getting into testing, for WordPress, PHP or any setup where you want acceptance testing, then check out CodeCeption.

And for some cool things, you might not think of PHP for such as ReactPHP for event-driven programming or Bref to run PHP on AWS Lambdas.

There are so many good projects, tools and libraries take a look through Awesome PHP I suspect you will be surprised just what you can do.

Best way for WordPress Developer to get started.

Carry on with your day to day jobs, but maybe start to look at Composer if you haven’t already this will lead you into a lot more modern side of PHP from their maybe consider Laravel my friend Ross has a freeWordPress to Laravel course.

Javascript and NodeJS

Again another but this is a language we already know Tim, and for many WordPress Developers you probably know more Javascript then I do especially if you do front end development. Javascript has come on a long way from making things appear and disappear in a browser. If your experience with Javascript is JQuery then you are in for a shock. As a backend developer, Javascript has become a backend language through NodeJS and while we can argue all day as to should it have it exists. Because NodeJS crosses the lines between frontend and backend through package managers like NPM it has built a very isolationist eco-system. If you are going to build and supporting frontend developers or building real-time services then Javascript is important to learn and understand as well as its eco-system. Also, Javascript or rather Ecmascript (complex eco-system remember) turns up in very unexpected places, for example, you can use Nginxscript inside Nginx config files.

Javascript also provides a good starting opportunity for desktop applications in the form Electron. Which powers tools like Atom, Slack and many other desktop applications.

Pros

  • Large eco-system
  • Existing Familiarity
  • Built in out of the box support for things like Async

Cons

  • Package management is a mess, meet NPM and cry
  • Packages even more variable then PHP developers
  • Javascript is a frontend language being shoehorned into doing something else

How do I use Javascript

I will be honest I’m not the greatest Javascript fan and while I maintain NodeJS instances it’s mainly to be able to use web projects that rely on webpack, grunt or another builder that could have been make.

However I have recently gotten into working with Electron to build Desktop Applications and started building more web interfaces using React, which also works well with Electron.

I also started to use Nginxscript where Lua is not available within Nginx for example when not using OpenResty.

Good Projects to follow

Coming from WordPress a bunch of Libraries are in use within WordPress but the new and interesting one probably is React if you are put of by Facebook there is also Preact which is a lightweight alternative. For mobile development, there is also React Native project.

Normally when discussing React, Vue.js is referenced as a great alternative and is especially popular amongst the Laravel community. For a totally different style of Framework consider looking at Svelte.

Not touched on in the above description of Javascript but Typescript compiled to Javascript but bring typed support as well as some extras. If you working with Typescript and looking for a build tool then check out Fusebox.

Finally going for Desktop Apps then the defacto project is Electron alternatives do exist within the Javscript eco-system to a certain extent React Native but also things like NW.JS.

There are so many good projects, tools and libraries take a look through Awesome Javascript & Awesome NodeJS I suspect you will be surprised just what you can do.

Getting started for WordPress Developers.

Again keep doing what you are doing, but Gutenberg block development will lead you down some interesting paths and probably will take you into React in the end. While it is possible to write vanilla javascript blocks the reality is so much of the tooling is for React. Joining and getting involved in front end development tasks will paradoxically provide the quickest route into backend Javascript as so much of frontend development relies on NodeJS for build steps.

Python a glue language for all your needs

If your only real experience with development in PHP/JS, Python is going to drive you mad… initially. However, once you get over it’s weird (to you) syntax and you stop putting semicolons everywhere you will realise Python is actually pretty quick to pick up. Indeed if I was asked for a language that someone new to computer programming should learn Python would be my language of choice. Python standard library is both good and standard, writing programs in Python rely on far fewer lines of code then comparable to other languages and hopefully without the need to rely on too many external libraries. If you are a WordPress developer reaching for a language for the web reach for PHP, not Python, PHP7 is going to be faster.

So why is Python on this list? Well once you step back from the web having a general-purpose language that allows you to develop small applications with rapid development is going to be on your list and while it’s possible to build similar applications in PHP to what you can do in Python you will find that Python development will be quicker and have more library support for non-web based tasks. If you start getting interests in things like Machine Learning then Python is the default tool for many.

Pros

  • Deep system integrations and large standard library.
  • Simple to learn and clean code
  • Defacto choice in many industries
  • Lot’s of applications you have heard of and use depend on Python for example Fail2ban is written in Python.

Cons

  • Slow
  • Un-training your brain to put semicolons everywhere is not as easy as you think, and whitespace suddenly becomes important.
  • Eco system is fragmented between versions and compatibility between versions is complex.

How I use Python?

At 34SP.com most of our codebase is Python so a lot of my day to day work is working with Python. Outside of work I use Python for most of my basic scripting needs, replacing a lot of the bash/PHP scripts of old. It is now the tool I start with not end up with for such scripts.

In addition, I have been working on some machine learning projects that heavily rely on Python and my houses home automation is managed via Home Assistant which is based on Python.

Good Projects to follow

A good starting points for diving into Python and what it can do is PyVideo a sort of WordPress.tv for Python and Python Programming community portal.

How to use Python to expose Politicians from PyCon UK 2019

For web development, almost the defacto choice in Python is Django a web framework similar to PHP frameworks like CakePHP.

If you have an interest in home automation, check out Home Assistant (which I use at home) and for game development Python has quite a few libraries including RenPy for a sort of choose your own adventure style games and Pygame for more general game programming.

For Machine Learning possibly the biggest name you might have heard of is Tensorflow or Pytorch but Python is used extensively and in emerging fields for good or ill including DeepFakes.

There are so many tools, libraries and frameworks for Python that I suggest just diving through the Awesome Python list to get a feel.

Getting started for WordPress Developers

Unlike Javascript and PHP there isn’t an obvious path to Python in your normal day to day jobs, probably the most likely place to encounter python is a side project (such as home automation) or a supporting project to your work like Fail2ban. If you work with shell scripts, then this perhaps provides a better route and consider your next shell script should it be a python script?

Rust, for those who were terrified of C++

Up to now, we have been talking about Dynamic scripting languages, that you will be familiar with and are quite similar in philosophy and features. Python vs PHP is almost a matter of personal preference in terms of what they can do. Rust, on the other hand, is a compiled language. So whereas with PHP we might do something like:

Php my-file.php to run a file or python my-file.py and it will run the program and include assorted files rust code needs to be compiled and the result is a binary application.

So Rust is more like C or C++, Rust is a fully-fledged language, you can build Kernel modules, complex games and anything you could do with C++. You can build PHP Extensions, and generate libraries which are binaries that can be called by other languages. On the Web, it can be compiled to Web Assembly.

And for PHP Developers good news it has curly brackets… Bad news that’s almost exactly where the similarity ends.

Rust is both a static and strongly typed language, meaning that before you use a variable it types must be declared and variables are tried to that data type. Both PHP and Python are dynamic typed and while there are options to enforce typed properties in PHP7.4 this is wishy-washy.

Pros

  • It’s fast, I mean really fast
  • It’s portable, while Binaries need to be compiled to given architecture the result is a binary application
  • It can do work with true low level aspects of OS, including things like eBPF

Cons

  • It needs to be compiled
  • It’s not as quick to get started and developing
  • Huge learning curve if coming from Dynamic Languages

How I use Rust

To give a little bit of the difference I rebuilt a PHP based tool to hash and compare password strings, to check for weak passwords based on an already salted password set. The initial application took several minutes to process through 100k passwords. The version written in Rust took several seconds and that was in part because of a logic bug. The ultimate performance difference with logic fixed over the original was nearly a 1000x faster.

I have also recently been working on a couple of PHP Extensions written in Rust, to allow a PHP application to make use of Rust performance under the hood.

I have also been building a couple of libraries for an Electron app, that once again moves heavy performance tasks to a binary and away from Electron.

Good Projects to Follow

Rust main package manager is Cargo while Rust development without cargo is possible it acts as a build tool as well as package manager making it a semi-critical piece. Individual packages are called Crates. For getting started Tensor Programming have an introduction to Rust series.

Being a competitor to C++ the breath of Rust projects is well everything from Embedded systems to Interacting with just about every language through FFI.

On the web, Rust can be the webserver to full frameworks with things like Rocket and building dynamic modules for Nginx with Nginx Rust Bindings.

Of course, you could also write a new Operating System in Rust… but should you?

While Rust is a younger language then any of the others mentioned there are still lots of resources, tools and libraries to be interested in so I suggest diving through Awesome Rustcollection.

How Should a WordPress Developer Start

Like Python the route to Rust is not obvious from WordPress for me the gateway was through the fact I could make PHP extensions that provided the route, I had however had some experience making PHP extensions with C++ so it was not an entirely cold start. A good potential place is isolated PHP programs such as the password tool above, something where performance is important but it’s not reliant on the WordPress stack.

.cls-1{fill:#fff}.cls-2{fill:#2f3a3e}.cls-3{fill:#3ab14a}Asset 1

Bash/Shell Scripting

You might have heard of bash as a shell for a unix the environment you login when you SSH into servers but it’s also a command language like all shells are (Someone going to correct me on that I’m sure). As such Bash can be a powerful tool and pretty much every unix system administrator dabbles with Bash scripts. Bash is a very simple language with none of the fancy features that come with the other languages mentioned, you won’t be doing object oriented, I mean would you?

I have included Bash but this is probably better seen as a more broader learning your shell including scripting and doing the quick jobs. It is the polar opposite of Rust but also the broadest spectrum. Good working knowledge of shell scripting means a good working knowledge of the fundamentals of your operating system.

How I use Bash

For me shell scripting is automation, if I’m repeatedly typing multiple commands, then it’s probably something I should be chaining, and if it goes beyond a one-liner then it should be scripted. I try where possible to think ahead will this need to interact with other things, am I concerned about performance etc. The reality things start as a shell script, when they become to complex they move to a Python script, with grumbling this is what I should have done in the first place. However really while I may grumble and have that mindset there is nothing wrong with using shell scripting for most typical sysadmin tasks and not everything you do needs to be a python script, nor do you have to reach for tools like Ansible.

Examples of some scripts I use every day, Simple stats gathering across multiple servers, checking mail queues, managing WP-CLI tasks, keeping my ZSH shell preferences in sync.

Good Projects to Follow

This list is probably harder than the others, while certainly should check out awesome Bash & Awesome shell and really get into customising terminals. When it comes to cool projects well Bash doesn’t lend itself to fancy stuff, even the how-to learn Bashresource is a hefty tome that feels from the 90s.

A really good resource is Julia Evans Zines which I particularly recommend Linux Debugging tools you’ll love. Julia also regularly posts on twitter, short extracts

file locking pic.twitter.com/tq1VRct5Hk

— 🔎Julia Evans🔍 (@b0rk) January 8, 2020

Some tools you will find really useful when working with Bash JQ for manipulating JSON, FZF for well-finding anything. If you are like me and a typo machine then a combination of auto-complete and Fuck might be wise.

Ultimately bash and shell scripting might not be sexy but it’s a valuable tool to know.

How Should a WordPress Developer Start

If you are finding yourself writing “reports” or processes that run via cron jobs anything like that, these are good opportunities for Shell Scripting, if you have just started using WP-CLI then combine that learning with shell scripting to unlock some powerful options.

Special mentions

Ok so these didn’t make it on the main list but I still think they deserve a mention they are each a powerful language in their own right but have lots of similarities to many of the above mentioned.

Lua

A true scripting language if you have heard of Lua it’s probably in relation to computer game modding? Mods for games like Civ series use Lua. For the WordPress Developer, the reason you might be interested in Lua is because of OpenResty which is an Nginx HTTP server with Lua scripting built-in. This makes OpenResty very flexible and powerful with big companies like the BBC and Cloudflare using it.

Lua is perhaps not a language you go out to learn, rather it’s a language to understand you will come across and it helps to get a little familiar with it. Lua is the ultimate tinker language.

To get a feel how about going through Awesome Lua

Elixir

Is the exception to the rule, when it comes to similarities, Elixir is a language that uses Erlang a different languages virtual machine. It’s a dynamic functional language and its use is mainly when you are working with high levels of concurrency. Elixir is a bit like Ruby on Rails in that it feels like a very different language to Erlang (though rails technically is not its own language just a framework but go with me) it’s built on all the benefits of Erlang or in Rails case Ruby. WordPress and PHP Developers are probably not naturally going to go to Elixir and I have included it here because it challenges a lot of how “we” program as someone who has worked heavily with Erlang in the past Elixir feels like a much-needed way into the eco-system and for that reason alone is worth checking out.

To get a feel how about going through Awesome Elixir

Go

Go is a badly named language managed by Google and wins the runner up award for bad name choices beaten by Hack by Facebook for dumb things to call your language for anyone who wants to Google you. Consequently its often called GoLang, it’s technically not a scripting language and compiles at runtime. Its roots is in C++. It’s statically typed but functional not object-orientated and fast. Not Rust level of fast but runs laps around Python. It’s use case is where performance matters but you want a simpler development time. I really like Go and it’s a solid choice as a second language for PHP developers.

To get a feel how about going through Awesome Go


Summary

So, first off I’m going to head off a few questions I expect/have already been asked.

Where is Ruby/Java/Kotlin/C#/F#/Q/R/Swift/Dart/Scala/Haskell/Crystal/The other Crystal language/Modula2/Delphi/Basic?

Or indeed plenty of other languages, right at the start I said this would be opinionated and based on experience. In 2020 these are languages I’m actively using that I think would suit WordPress Developers one way or another. I would love to have put Erlang on the list (ok so I sort of did sneaky sort of way) and plenty of other languages. Also if you are in certain fields Mobile development for example then Kotlin and Swift might be more appropriate, I have little experience with either.

Why did you choose Rust/Python over Go?

Two people who proofread the article, one said I’m surprised you put Rust instead of Go and the second said I’m surprised to see Python not Go on there. Obviously Go gets the honourable mention. It sits in between the space between Python and Rust but the reason I didn’t pick it for the main article was primarily that Python and Rust do great jobs. If you are looking for a multi-purpose language then Go is a great choice. If you are already using Python there are fewer reasons to move to Go and the same if you using Rust then Go doesn’t make much sense. PHP/Go is a fantastic combination so don’t discount it.

Do you really need to learn more than one language?

You don’t have to but if you’re a WordPress Developer you will end up learning PHP and Javascript. You can for the rest of your career rely on those skills and you have made a good solid choice. Learning a new language adds complexity and often brings new fundamentals if it’s not something you enjoy don’t do it. However, even if you never learn Rust or Python I really do recommend you take a look at some of the examples just to be familiar with what they are. You never know something might just click.

So finally If I had some recommendations for developers based on skill level as to where to head off first I would say:

Junior WordPress developer

If you are a junior WordPress developer maybe just started writing your first plugin then I suggest concentrating on Javascript and Bash/Shell Scripting these two will more then anything push you forward in your career and get you going quickly.

Senior WordPress developer

For more senior folks and those looking to get into the more DevOps side then at least look at how Python/Go works and consider really diving deep into PHP internals and foundations looking out of the WordPress ecosystem.

There will come a point where performance, stability really matter and then I suggest it’s time to look at Rust.

So there you have it, I’m sure some folk are going to tell me I’m wrong, you are of course right because this was my list and recommendations which are based mainly and totally biased on my own journey.

I would love to hear your journeys through in the comments below.

Illustrations used in the article by Undraw

Source

Top comments (0)