If you ask in forums or with experienced developers which programming language you should use, you will hear two statements.
- Use the programming language that is suitable for your application.
- Use the programming language in which you have the most experience.
In my case, I have already worked in web development for 12 years. After deciding which project I would tackle next, it was clear to me that I would stay in web development. According to the recommendations of experienced developers, I should also stay with PHP in this case. Why should I switch to another language when I know it will take much more time?
What makes PHP good?
I still think PHP is a good choice for programming web applications on the backend. When PHP came into existence, it was quite cumbersome to deliver HTML pages dynamically. PHP has solved this task well. It is easy to learn and makes it easy to develop simple web applications.
But time has moved on. While it used to be about delivering web content in the form of HTML and a little CSS + JavaScript, the use cases have changed a lot.
Today’s applications are more like a network of different software packages, services and frameworks. The delivery of dynamic HTML is delivered by already existing software packages like shop systems, CMS, ERP or whatever. In addition, websites have become much more interactive today, so JavaScript takes over a large part of the HTML generation.
The main tasks that still need to be done in the backend (i.e. on the server side) are essentially the following:
- Resolve routes
- Authenticate users and check rights
- Validate request data and forms
- Write and read database
- Make API calls here and there
- Return HTML or JSON results.
These tasks have become so elementary today that they are implemented several times in every programming language worth mentioning through frameworks and ready-made software packages, in some cases without any programming effort. This means that what PHP was originally used for can be realised by countless equivalent or better solutions.
What PHP can’t do?
Due to the age and prevalence of PHP, you can really implement a lot of things in PHP. Also, it’s undeniable that the PHP community has been making great strides since version 7 to clean up and improve the language. PHP is not very innovative, but they are good at adapting concepts from other languages. In fact, most PHP web developers see no need to use any other programming language. (Apart from JavaScript for the frontend, of course).
The crux of the matter is that this is also true for many other languages. Anyone who has to choose a programming language these days will hardly see any advantages of PHP over other programming languages.
If you mainly want to develop web applications, I would rather recommend JavaScript/TypeScript. Because no web service can get by without JavaScript. That means you will have to touch JavaScript one way or another. It makes almost no sense to learn an additional server language, although all tasks can also be implemented on the server side with JavaScript and Nodejs.
The only argument I’ll give in favour of PHP is the fact that many companies use PHP. This means that the demand for PHP developers is always high and you don’t have to look long for a job if that’s what you want.
So why Python and not JavaScript?
From the previous considerations, I too have started to focus entirely on JavaScript. But we should take a look at what applications are still being developed today. Because as I already mentioned, there is already completely ready-made and often free software for all possible use cases that can be integrated. When you develop today, you develop a kind of glue between the individual components and a user interface for the user. JavaScript is a very good choice for this.
The other case is the development of applications for which there are still no or only few or poor alternatives. In this case, one will often have to work with niche solutions. To show which use cases I mean, try to implement the following use cases in PHP or JavaScript:
- Open a PowerPoint presentation as a template and exchange individual contents.
- Convert HTML into accessible PDF.
- Analyse data
- Render diagrams for reports on the server side
- Apply machine learning models
These are just a few examples that I have come across recently, and with all these use cases you often have to search for a very long time. Most of the time, the solutions are no longer implemented in PHP, but run as independent software. Then one helps oneself with an additional server that has to be addressed via an additional API. Or you call a shell from PHP. Both are always a nuisance. Because it bloats the entire application with additional necessary programmes that run alongside.
At this point, however, you are also at the end with JavaScript. Because JavaScript only became popular much later, exotic topics are sometimes not dealt with at all. That’s exactly what showed me that I can’t implement my applications with JavaScript alone.
When I look at my use cases and the approach I’ve taken so far, I’m left with Python and Java.
First project with Python
Python is not completely new territory for me, so I knew what I was getting into. However, I had never implemented a web application in Python before. After my first small project with Dojo, I am totally hooked.
For me, Python is the undisputed number 1 when it comes to getting results quickly. While Java in particular is an incredibly powerful language with all kinds of use cases, comparatively you have to write tons of code to implement the same things that are done in Python with a few lines of code.
Of course, there are all kinds of frameworks to make your job easier. In PHP, Laravel and Symfony are very popular and widely used frameworks for web applications. But with neither of these frameworks can you get a result with as little effort as with Dojo.
Apart from the efficiency in development time, I am especially happy about the following small features of Python.
- The code is relatively small.
- The debugger works out of the box (unlike Xdebug in PHP).
- Performance profiling works out of the box
- Syntax is minimalistic (no $ and -> and {} characters)
- Most things just work. No configuration hell like Node.js
- There are ready-made implementations for all sorts of use cases (even the exotic ones).
- In Python, you are not limited to server applications. (Desktop applications are also possible without much extra effort).
What about you? Would you recommend PHP as a starting point for a budding programmer today? If yes, why? If no, which language would you recommend?