Want to be a Web Developer? Learn Node.js not PHP

Andrei Neagoie
Andrei Neagoie
hero image

It’s a metaphor… I think.

One of the most common questions I get asked by my students is “How come you teach Node.js and not PHP in your course?”

Telling people “trust me, I work in the industry” simply isn’t enough.

So, this is my reason for including Node.js in my Full-Stack Web Development course (plus an advanced Node.js course and why if you want to invest in your future as a developer, you should ditch PHP.

Although I use these two as an example, in this article, I show you a framework for deciding on what tools, programming languages, frameworks, and libraries you should learn next throughout your developer career.

With your limited time and resource as a developer, you have to make a decision on what to invest your time into to get the greatest return for this investment.

Now, the question you should be asking yourself: What can I invest time and effort into learning that has the greatest net value on my future career as a developer in terms of knowledge, salary, and satisfaction?

This doesn’t mean picking the easiest path. It means picking the tools that allow you to stay relevant and competitive for many years to come while also developing your skills to be a senior developer.

In the Conclusion of this article, you will find all of the technologies I recommend in 2018 (and still now in 2022) if you want to be a web developer using the same analysis done below. So you know, you can skip to the end if you’re impatient. Otherwise, grab a fair trade, organic, made with love, yerba mate tea and let’s go on a nerdy adventure.

We are going to use two types of analysis in this post: Job Prospect Analysis and Technical Analysis. Here we go:

source: https://vizteck.com/blogsource: https://vizteck.com/blog

Node.js vs PHP — Job Prospect Analysis

We will be using Stackoverflow developer survey and LinkedIn for this analysis. We will also only focus on technologies related to web development.

Popularity:

For the fifth year in a row, JavaScript was the most commonly used programming language. The use of Python overtook PHP for the first time in five years. Where is Node.js in here? Node.js is a javascript runtime. In non technical speak: Node.js is a way to use Javascript like you can PHP on the server side. For now, think of Node.js as Javascript.

As you can see, Node.js and Javascript rank at the top while PHP is significantly less popular.

In the five years Stackoverflow has been collecting data in the Developer Survey, they have seen languages such as Javascript and Node.js grow in popularity, while the usage of languages like PHP has been shrinking:

React is the most loved among developers, however, Node.js is the most wanted and second most loved:

Salaries and Opportunities:

Developers using languages listed below the blue line in the chart below, such as Go, Rust, and Clojure are being paid more given how much experience they have. Developers using languages below the blue line like PHP, however, are paid less even given years of experience. The size of the circles in this chart represents how many developers are using that language compared to the others. PHP significantly seems to be rewarding developers less and less with the number of years experience that they have.

On LinkedIn Jobs, you can see the job posting worldwide for Node.js developers far outweighs PHP developers by almost 10,000. This is despite the fact that Node.js is a much younger technology compared to PHP, and the fact that PHP is used heavily with Wordpress which powers 30% of all websites on the internet.

Finally, you can see the average salary for technologies by Region (I didn’t include the Worldwide tab below because PHP didn’t even make it on there):

Again, we are not bashing PHP here. We are just looking at the numbers to decide what to chose to learn. It is clearly ranking consistently below other technologies like Javascript and Node.js.

UPDATE: Since releasing the post, stackoverflow came up with the result of the 2018 survey. The decline in PHP is growing.

Verdict:

PHP popularity is decreasing while the job market and popularity of Node.js is growing. Overall, PHP developers are paid significantly less than other developers and the trend seems to keep widening.

Node.js vs PHP — Technical Analysis

Let’s take a look at pros and cons of each technology.

Node.js Pros:

  • Especially suitable for applications that require real time communication between client and server. Tools like socket.io make building things like chat applications really easy. This same features makes Node.js suitable for applications that process data from IoT devices (Internet of Things) and Single Page Applications (SPAs) which are very common now.

  • Native serialization and deserialization with JSON which works great with AJAX requests on the web.

  • Great for event driven applications that have non blocking Input/Output (I/O is the communication between an information processing system, such as a computer, and the outside world, possibly a human or another information processing systems like Databases)

  • You learn Javascript, you learn Node.js. You don’t need to learn another language like PHP. That means you can spend all your efforts learning Javascript really well and mastering it. You will be able to write both frontend and backend code with just one language.

  • Many popular client-side frameworks such as React, Vue, and Angular are written in JavaScript which is the main language of modern browsers. While using Node.js server-side, you have all the benefits of one scripting language across your application development stack. Having the same language both on the front and back end is excellent for maintainability: It makes the work between all team members easier for your application because both frontend and backend developers work with the same JavaScript data structures, functions, and language conventions.

  • The single-threaded event driven system is really fast when handling lots of requests at once from clients.

  • There are ever-growing 3rd party libraries and packages accessible through NPM for both client and server-side, as well as command-line tools for web development. Additionally, most of these are hosted on GitHub, where you can report an issue, or you can fork the code yourself to customize it.

  • It has become the standard environment in which to run Javascript related tools and other web developer related tools, including task runners, minifiers, linters, formatters, preprocessors, bundlers and analytics processors.

  • Natively supported on many new APIs and services like AWS Lambda.

  • We get all the performance gain of V8 which is the Google JavaScript interpreter that Node.js is built on top of. Since the Google’s engineering is constantly improving performance on V8, Node.js gets the benefit of this development for free.

Node.js Cons:

  • NPM packages mentioned above can bloat your code, can be insecure, and it is hard to find which packages are good since there are so many options (Looking at downloads and GitHub stats is one way to fix this issue).

  • Huge number of ways to build servers using Node.js and npm packages. This makes it harder for new developers to pick up.

  • Not ideal for servers that are dependent on heavy CPU consuming code (i.e. heavy algorithms like image processing or sorting). Generally, anything that isn’t I/O can be thought of as CPU consuming code. Usually a multi-threaded server environment is a better option than Node.js in this case (Solution: if needed, you can hand CPU intensive parts of your code to a program written in C).

  • Node does not utilize all cores of an underlying system or machine. You have to write logic by yourself to use multi core processors. This can be achieved in many ways but it requires a bit of extra work (This becomes a pro when you are able to maximize CPU usage of the system).

Node.js Verdict:

Node.js is well suited for applications that have a lot of concurrent connections and each request only needs very few CPU cycles. This makes it extremely ideal for many of the applications currently on the internet like SPAs and real time applications.

Using JavaScript’s built-in asynchronous processing, one can create highly scalable server-side code that maximize the usage of a single CPU and memory while being able to handle more concurrent requests than conventional multithreaded servers.

Node.js comes with very few dependencies, rules and guidelines, which allow a developer to have the freedom and creativity in developing their applications the way they want to. Developers can select the best architecture, design patterns, modules and features for their project while getting all the benefit from the community through NPM.

PHP Pros:

  • Strong and big community because of its age.

  • PHP has a powerful codebase that includes popular platforms for building websites (i.e. WordPress, Joomla, Drupal). CMS (Content Management Systems) such as WordPress, make it easy to deploy a blog or an e-commerce site in a matter of minutes and allow non-developers to customize them easily.

  • Easier to set up with non developer tools and preferred for individuals or small companies that don’t need to have knowledge of SSH and Linux servers. Numerous PHP applications (i.e. cPanel) are offered by basic hosting platforms which can be installed in one click.

  • Unlike other general purpose programming languages, PHP was designed specifically for the Web. PHP offers a great server side solution where there is no need to bother with JavaScript in the browser since all pages can be easily generated and rendered on the server. This is useful if you want to avoid shipping too much code on the client side. Node.js is able to do this as well, but the solution isn’t as simple.

  • PHP7 and HHVM (Supported by facebook) developments have improved on PHP performance… but recently some bad news for HHVM.

PHP Cons:

  • PHP is only used on the back end. This means you still need to learn Javascript if you want to work on the client side or be considered a full stack developer.

  • With PHP, heavy server-side rendering and numerous requests to the server to generate and render pages is not be a good option for Single Page Applications.

  • Each active client eats up one server process. Not ideal for apps with many client connections.

  • Native support for PHP on new APIs and services like AWS Lambda is limited compared to Node.js.

  • It follows the classical client-server model where every page request initiates the application, database connection, and HTML rendering. This makes PHP slower as you navigate through a website in comparison to Node.js application that runs permanently and needs only to initialize once. Because of this, Node.js is more suitable for the newer direction that the web is evolving into with HTML5, AJAX and WebSockets.

PHP Verdict:

PHP is simpler to learn with a big community around it. It is a good choice for a standardized solution such as blogs or news sites. It has the power of Wordpress which is the most popular CMS (Content Management System) which allows you to create customizable blogs without too much coding. However, simpler in this case is not a good quality. The easier it is to learn a technology, the easier it is for someone to enter the field and increase the supply pool, and the lower you will have to charge for your services.

Conclusion

PHP was one of the top languages in the Web 1.0 era with the popularity of Wordpress. Node.js was launched in 2009 and is technically not a language but a runtime environment for Javascript. It is the champion of a younger web development generation and is better suited for building event-based, data driven , I/O heavy applications that you encounter more in the Web 2.0 era.

In particular, asynchronous and event-based architecture of Node.js makes it a great fit for real time applications such as messaging and collaborative apps in which many requests are happening concurrently and there is a lot of back and forth between the client and the server. Can’t live without Wordpress? Well Node.js has it’s own CMS that is awesome called Keystone.js.

There are always going to be tradeoffs. There is never going to be one technology that you can learn that will solve all problems and will make you immune to job obsolescence. The best we can do is to analyze our options and pick the one that will have best return on investment. Looking at the job prospect analysis and technical analysis above, we can see a clear winner.

I pick Node.js.

Although all technologies are great if used in their own specific way, we live in a world where information is so abundant that we have to limit the amount of topics we can focus on and deeply learn.

In my course, I teach methodologies that are relevant today for a professional career in the field, and also the tools used by some of the biggest companies like Facebook, Netflix, Google and Amazon. If you want to be a full stack web developer in 2022, I recommend you learn:

  • HTML5
  • CSS3
  • Javascript
  • React.js
  • Node.js + Express.js
  • PostgreSQL
  • and a few others…

You can learn about them more by reading my article on learning to code in 2022 or checking out our Fullstack Web Developer Career Path that takes your from zero experience to having the skillset to get hired as a developer.

UPDATE: Discussions around technologies should have opinions from both sides, which is why I recommend you read around. Keep in mind that there are always tradeoffs, and what tools you use in your profession is ultimately up to you. The best we can do is be informed about our choices and not follow blindly. Finally, be willing to consider opinions different than yours.

Want a dedicated Node.js course to build large scale apps?

We have an entire course dedicated to Node here, and you can check out the first 6 hours below, for free!

By the way, my full time job is to teach people to code in the most efficient way possible as the Lead Instructor of Zero To Mastery Academy. You can see a few of my courses below or see all of my courses by visiting the courses page.

More from Zero To Mastery

7 Ways to Earn a Side Income as a Developer preview
Popular
7 Ways to Earn a Side Income as a Developer

7 different ways in which you can leverage your web development skillset to earn an extra income on the side

[Full Guide] Learn To Code For Free in 2024 & Get Hired in 5 Months (+ Have Fun Along The Way!) preview
Popular
[Full Guide] Learn To Code For Free in 2024 & Get Hired in 5 Months (+ Have Fun Along The Way!)

Updated for 2024 (including A.I. & ChatGPT). In 2014, I taught myself how to code & got hired in 5 months. This is the step-by-step guide I used. Now 1,000s of other people have also used it to learn to code for free & get hired as web developers.

ZTM Career Paths: Your Roadmap to a Successful Career in Tech preview
Popular
ZTM Career Paths: Your Roadmap to a Successful Career in Tech

Whether you’re a beginner or an experienced professional, figuring out the right next step in your career or changing careers altogether can be overwhelming. We created ZTM Career Paths to give you a clear step-by-step roadmap to a successful career.