Choosing the Best Language for the Project: Deciding between PHP and Ruby on Rails

code@2x-2

PHP

The positives:
  • Has tons of frameworks and solutions for multiple purposes, e.g. WordPress as a simple CMS is much easier than having to build one with Rails.
  • It’s very simple to deploy, it just requires being copied into a LAMP environment to start working. (No special setup or need for command line).
  • It’s safe to say that it has the largest developer community and has some very promising frameworks that are available now, such as Laravel and tools like Composer.
  • Has widely used standards body which the community has rallied around PHP-FIG with popular standards such as PSR-0 and PSR-4
  • Scales well with companies like facebook using it as their language of choice
  • Learning curve is very low
The potential downsides:
  • It’s too forgiving which can allow programmers to fall into bad habits
  • Maintaining applications can be a huge pain
  • Has a history of independent projects not working together on language wide libraries. Communities in the past have been locked into the mindset of  “not built here”.

 

Ruby

The positives:
  • Mature and well supported by the community (expect long lifespan).
  • Good choice for rapid development / prototyping.
  • ActiveRecord ORM is awesome and easy to use (for interfacing with databases).
  • Gems, which allow you to plug in prebuilt functionality into your application quickly. It just requires adding them to your Gemfile and installing.
  • Fantastic testing tools, such as Rspec, and Capybara.
  • Its syntax is super pretty.
The potential downsides:
  • There are many ways to deploy and manage a Ruby frameworks, all of which usually require configuring some kind of web server, such as Unicorn, Puma, or Passenger. Figuring out what approach would be best for your app is one of the trickier parts to managing Rails apps.
  • Learning curve. Tips, tricks, and best practices in Ruby are like arcane knowledge. You’ll either toil away for years before you’re ever able to figure it out on your own, or you’ll have to have a much more experienced level 99 Ruby dev teach you the secrets to its dark arts.

The ugly side of both:

Both either provide or use templating language/tools. This is a trap, don’t do it. Let server side handle server side, and front end frameworks handle the rest.

And the last word…

PHP may be a language that’s easier to use and pickup on the server side than Ruby, but historically it has a hard time competing with Ruby when it comes to its frameworks’ capabilities.