DEV Community

Andrew Lewell
Andrew Lewell

Posted on

The Battle of (Web) Back-end

Last week as I once again found myself marvelling at the ease of which Rails allows you to generate models and controllers with a simple command, I found myself wondering how it is possible that Ruby on Rails is not the most popular and commonly used programming language for back-end web development.

I decided to do some research, and hopefully understand better the pros and cons of the various popular back-end web development languages. I am going to focus on 3 of the most beginner friendly languages at the moment which also happen to be probably the 3 most popular: Ruby on Rails, PHP, and Node.js. An honourable mention goes out to Python, Scala, Java, GoLang, and the many other back end languages out there. So without further ado..

Ruby on Rails

Ruby, along with it's popular and ubiquitous framework, Rails, is the back-end language I have been learning over the past couple of weeks. Despite having many advantages, it is not the most popular back-end language currently.

Advantages

  • Generators - Rails allows you to generate a lot of code with simple one line commands. This saves a lot of time and allows an MVP to be built very quickly.
  • Libraries - Ruby has a vast library of code that are accessible via the gems. Almost anything you can think of has been built already and is freely avaible as a gem.
  • Readability - Ruby is a very succinct and readable language. This makes it a favourite for new coders and coding bootcamps. The easy to grasp syntax makes it easier to focus on learning the programming concepts themselves.

Disadvantages

  • Speed - The biggest argument against Ruby on Rails is the run-time speed. It can be considered "slow" compared to some other languages such as Node.js, but realistically this is rarely going to be an actual issue for the majority of applications. Twitter famously migrated from Ruby to Scala as they had some scaling issues due to the massive surge in popularity of their website.
  • Documentation - Some of the Ruby documentation can be shockingly bad, and often it is better to refer to previously asked questions on websites like Stack Overflow than to try and dig through the official documentation.

PHP

PHP is officially the most commmonly used back-end language, with 83.1% of the market share in 2018 accoding to W3Techs.com. The massive market share comes down to it's age and staying power, being one of the oldest server side languages around, many websites and applications are built on it. Facebook was built on PHP for example.

Advantages

  • Library support - There are variety of code snippets that allow PHP developers to automate common tasks such as session management, authentication and security. These libraries also allow applications to be built more quickly.
  • Speed - PHP is considered relatively fast as it does not use many system resources.
  • Popularity - The popularity of PHP itself also helps keep PHP relevant. As it is such a commonly used language, many new developers will learn PHP in order to increase their employment opportunities.

Disadvantages

  • Scalability - PHP does not scale well with large applications. PHP code for huge apps will be difficult to maintain.
  • Poor error handling - It is widely believed that the error handling offered by PHP is sub-par, especially in comparison to other languages. There is a lack of debugging tools which can hinder development.

Node.js

Node.js is a newer but increasingly popular technology. It is essentially a runtime environment for JavaScript which allows JavaScript to develop the server side of a web application as well as the front end.

Advantages

  • Low barrier to entry - It is built around JavaScript which means front-end developers will have an easy time picking up Node.js. This also means the front-end and back-end can both be built by the same developers!
  • Great performance - Node.js is known to have great performance. Node.js interprets JavaScript via Google's V8 JavaScript engine, which converts JavaScript into machine code, which is run faster and more efficiently.
  • Flexibility - Node.js is very flexible allowing developers more freedom when developing apps. This is in contrast to languages such as Ruby where there are much more strict guidelines enforced.
  • In demand - Node.js is one of the most fashionable and fastest growing languages, making developers very much in demand. Although it is based on JavaScript, it still takes a while to become familiar with the intricacies of Node.js, meaning not all JS professionals will be able to work on Node.js projects immediately.

Disadvantages

  • Less library support - The code libraries of Node.js are less thorough than other popular languages. This means more manual coding has to be done during development.
  • Bottlenecks with highly computational tasks - Without going into too much detail, Node.js struggles with CPU intensive tasks due to it being built on JavaScript which only uses one thread. Modern CPUs have multiple cores, which are the physical equivalent of a virtual thread. When given an intensive task, the CPU will usually split the task between threads to improve processing speed. Javascript however is designed to carry out front-end tasks which are generally not CPU intensive so only require one thread.

Conclusion

As you can see, there are arguments to be made for and against all of the popular back-end programming languages. I think any of the above options would be a good option for a beginner learning to code - I am certainly enjoying learning Ruby on Rails, and will aim to learn Node.js in the not-so-distant future!

Top comments (1)

Collapse
 
oussamaennadafy profile image
oussama ennadafy

good article, in the point of nodejs has Less library support it's not typically because npm is the default package manager for nodejs and it's has over one million package, and also it's the largest packages repository not only in back-end development but in the hole software industry, thanks for sharing