Toy animals

A language is not a tribe

We have probably always been tribal by nature. It’s comforting to nestle in familiar surroundings with your people, your proven ways of doing things, your habits of speech and thought. There’s nothing wrong with that, as far as it goes. But then it’s easy to grow suspicious of the strange, to confuse difference with malignancy or inferiority. Once upon a time, this was probably a half-decent survival mechanism. I doubt that it was ever a path to enlightenment, though. Nowadays, tribalism is a scourge.

People like to talk about communities. There’s a PHP community, there’s a Python community. Both are fine and inclusive spaces. But you don’t have to dig too deep to find coders shoring up their sense of belonging by casting shade on other languages. Try searching PHP sucks or Python sucks. How many of the these takes are good faith assessments? How many are tribal?

If, like me, you’re an experienced PHP programmer, it’s easy to respond to bad faith attacks on the language by replying in kind. What if we were to do something radically different, though? What if we were to embrace other communities, to move from an either/or mindset and look for the opportunities offered by their languages? What if we were to widen our outlook, improve our earning potential, bring back treasure?

First, though, let’s play devil’s advocate. Perhaps we should abandon PHP altogether.

PHP: Is it time to jump ship?

The case made by the PHP sucks brigade seems to consist largely of a series of straw man arguments – usually partial, often outdated, sometimes simply wrong. We could fill up the rest of the article assessing each charge on its merits – or lack thereof. Let’s not do that. PHP is a powerful language which has long outgrown its hobbyist roots. It continues to evolve alongside its peers (from whose best featues it happily borrows with every major release). While it is possible to write horribly ugly code in PHP, that’s pretty much true of any language. The only thing that might prevent a developer from writing beautiful code in PHP is the developer himself or herself.

PHP also remains extremely popular. According to one source it is used by over 77% of websites. Even if we take that as generous, it certainly continues to power a significant proportion of the Web.

On the other hand, PHP is some way down the leader board when it comes to pay rates. Last year, for example, devjobscanner put PHP below the top twenty in the best paid league table. According to which assesses the popularity of programming languages based on Google searches, PHP comes in at number six – behind Python, Java, JavaScript and even C#. At the time of writing, Tiobe, which uses a wider range of metrics to calculate popularity, places PHP at number eight and Python in reliable first place.

So, should we be preparing the life boats? I would argue not. While some other languages skills might command higher rates, it’s important to remember that high demand. Take the devjobscanner figures. The top earner, Solidity came in at 417 jobs, set against PHP’s 8.8k jobs. So, although PHP places relatively poorly on pay rate alone, once you remove those higher-rated languages that only offer a few available positions, it rises up the table considerably.

Why add a new language?

So PHP remains in high demand and pays reasonably well. If that’s the case, why should you add a new language to your skill set? Here are some reasons.

Diversity is good

I came to PHP while also using Java, JavaScript and Perl. All of those languages informed my understanding of PHP and influenced the ways in which I have been able to use it. From Perl I gained a command line sensibility and a facility for both regular expressions and array juggling. JavasScript dovetails neatly at the front end with my server skills. Java gave me an object-oriented design focus that still informs the systems I build. By investing in a new language, you enrich your experience across the board.

Diversification reduces risk and increases opportunity

PHP is not going anywhere for sure. On the other hand, adding a new language will allow you to approach a wider range of potential clients. Times are hard in the industry right now. Silicon Valley employers have been announcing layoffs more or less across the board in recent months and, anecdotally, I have seen quite the uptick in ‘available for work’ messages in online communities. Skills provide some hedge against risk when the competition for jobs and contracts hots up.

Different languages offer new affordances

Everyone knows that PHP is optimised for the Web. Of course, it can be used for all sorts of purposes but it might not be your first choice if you needed to build a graphical UI or a multi-threaded application. Computer languages tend to overlap, but each will also excel in distinct areas. The make up of the developer communities that favour a language will also influence the range and nature of available libraries and tools.

Learning is fun

This one is subjective. I get a kick out of learning and teaching new stuff – it’s as simple as that.

Why Python?

The language you choose to learn will depend to some extent on what you need to achieve. Here’s why you might consider learning (and why I’m writing about) Python.

Famously, everything is an object in Python. The community prize elegance, simplicity, and clarity. If you love the idea of code that can aspire to the utility and beauty of a Shaker chair then you might find inspiration in Python.

Python is very much in demand. In the last month or two, I have been part of several pitch meetings and fielded two contract enquiries in which Python was mentioned as a required skill. A more recent devjobscanner article which covered demand rather than pay placed Python in second place behind Javascript for the first half of 2023. PHP came in at number five. If you might find yourself looking for a contract or a permanent position in the foreseeable future, it makes sense to have more than one popular language to your roster. Heck, have as many as you can.

Money is rarely my greatest motivator, but I like the independence and choice it can buy. Python comes out pretty high on every pay rate graph which, when combined with the fact that there are a good number of jobs and contracts available, makes it an attractive option for a new language.

Like PHP, Python boasts an active developer community and therefore offers access to a wealth of libraries and tutorials. For that reason, for example, Python is probably the go to languages for machine learning tools and resources.

Python for PHP Programmers

Python, like PHP is often touted as easy to learn. That’s true to an extent. But there’s a lot of it and there are plenty of traps for the unwary – especially if you are bringing expectations along from another language. On the other hand, if you’re a PHP professional, you already have the skills and conceptual framework you need to get coding fast.

Python for PHP Programmers is a book in progress and will be available for pre-order this year. The good news, though, is that it’s being written in public. That means that we’ll be publishing articles from it here every week. Each article will be designed to help you apply your existing knowledge of PHP to Python, attempting to answer the question ‘I know how do this in PHP, what is the equivalent in Python?’. A discussion section will dig deeper. Even when code looks similar across languages, there are often underlying issues to consider, gotchas to be aware of, differing conventions and standards. We’ll also cover false friends – those seeming similarities that can tempt you make mistakes or miss opportunities.

We will be offering the book for free to some beta readers. You can sign up for that at the book page or sign up right here for the book news mailing list.

Yes! Please sign me up to this newsletter

We will start tomorrow, as is traditional, with Hello, World.

Photo by Jaeyoung Geoffrey Kang on Unsplash