NodeJS vs PHP: what is better?
Posted June 1, 2015on:
The competition in the server side programming department is getting tougher with each month, especially with the recent popularity of NodeJS. However let`s look how everything began.
PHP appeared about 20 years ago, in 1995 and ever since then it has been a number one language for back-end developers and has gathered a big community behind it. For a long time there wasn’t any good reason why not to use PHP: it`s rather easy to use PHP, it`s supported by the majority of hosting companies and it has become the most commonly used language in terms of number of websites powered by it.
Of course, everyone has his own truth: one coder will praise the speed of NodeJS while the other will be devoted to the stability and long history of PHP. But let`s have a look at strong sides of both for you to decide whether to concern yourself with the so popular nowadays NodeJS or not.
PHP strong sides:
– Huge community and tons of materials for all programmers, from a beginner to an advanced coder.
– Deep code base. The most popular platforms for building websites (WordPress, Drupal, Joomla) are written in PHP. Not only are the platforms open source, but so are most of their plug-ins.
– Easy to find a hosting company. PHP has been the industry standard since the stone age and any hosting company still surviving is bound to be compatible with it. For Node.JS you still need to make a little research.
– Simplicity. PHP can be run inside of the same file as html.
– Speed of coding. For most developers, writing PHP for Web apps feels faster: no compilers, no deployment, no JAR files or preprocessors — just your favorite editor and some PHP files in a directory.
– Mixing code with content. You just open up PHP tags and start writing code. No need for templates, no need for extra files or elaborate architectures.
– No client app is needed. All of the talk about using the same language in the browser and on the server is nice, but what if you don’t need to use any language on the browser? PHP is a way out.
NodeJS strong sides:
– Speed. NodeJS is blazing fast compared to PHP. This is where Node really kicks assJ.
– Separation of Concerns. NodeJS separates fundamental components up giving a clear separation of concern across controllers / routes, models and views.
– New and fresh. It’s newer in comparison to PHP and has been developed by programmers who have full knowledge and understanding of modern web applications, from the server to the client, and that means more modern features.
– JSON. NodeJS is a powerhouse for JSON. Accessing SQL is possible and there’s plenty of plugins that make it possible, but JSON is the lingua franca for interacting with many of the latest NoSQL databases.
– Gridlock. NodeJS uses a callback structure to pass logic from one asynchronous call to the next meaning we never have to worry about spawning new threads or even considering the deadlock process. Almost no function in Node directly performs I/O, so the process never block which is a major implication for scalable systems.
That is a difficult decision when it comes up to decide which language or tool to choose. But NodeJS worth considering and it`s proved by the fact that Node is getting more and more popularity every day. And what is your opinion on NodeJS, is it the future of web?