Ruby on Rails is our workhorse. It underpins everything we do. It’s a framework, it’s a community and in many ways, it’s an ideology. Where some people might build web applications with Java or PHP, we use Ruby on Rails. We don’t need a user interface or fancy looking out-of-the-box templates & we never have to rely on unreliable code or plugins created by enthusiastic amateurs. Reliability and functionality is the name of the game...
Why Ruby is best for our clients
This really is the most important point. Although the bulk of this article will outline the merits of Rails itself, let’s not lose sight of the fact that the main purpose of a programming framework is to ultimately enable/empower end users who actually have no interest in the programming framework itself. They just want it to work.
- For the purposes of our clients, Rails enables them to:
- Save time and money during build and future development phases
- Have the peace of mind their site is futureproofed
- Have the peace of mind their site can handle large volumes of traffic from the outset
- Have the peace of mind that their developer is a happy developer
Ok, maybe not that last point but you know where we’re going here. In short, Ruby on Rails saves us time which enables our clients to save money and enjoy a robust affordable product. Although the rest of this discussion will focus on Rails from a programmer's’ perspective, it all goes back to this fundamental point.
Rails and it’s alternatives
There is of course a general advantage of using coding over a more publicly accessible templated system like Wordpress, but even when you compare Ruby on Rails to another language like PHP, there is still a massive difference. In about 10 minutes you can create a simple but useful app in Rails, but there’s no way you could do the equivalent in PHP. 10 minutes in PHP will get you nowhere, and you couldn’t get much further in half a day.
See below for a rundown of some of the most popular web-building options:
- Rails is a software library that extends the Ruby programming language which allows us programmers very low levels of abstraction - we can create anything we want
- PHP is a programming language which is very powerful in the right hands, however onboarding is more difficult and prototyping takes a lot longer. It does nevertheless have a strong underlying philosophy which can breed great programmers.
- Wordpress is an open source website creation tool (content management system) written in PHP. Wordpress can be used in two ways:
- Developers can download the tool then host the website themselves. These developers can create their own templates and plugins or use ones created by third parties.
- Non-developers can signup at wordpress.com and create their website using third-party plugins and templates. No programming knowledge is required.
- Wix is an online website creation tool for non developers.
Why is onboarding great with Rails?
For anyone with a remotely developed knowledge, the onboarding process is seamless with Rails. Straight out of the box, there are a number of basic features that allow for very fast prototyping, while strong software engineering patterns encourage logical and stable development.
One such pattern is “Convention over Configuration” (CoC), which allows developers to create things quickly while still allowing them to make fundamental changes further down the line.
The other important Rails methodology is “Test driven Development” (TDD), which dictates that the tests are written before the code itself is written. This gives the code genuine reliability and also makes it easier to maintain.
The ultimate futureproofing
Thanks to a thriving open-source community, Ruby on Rails is always evolving. The programmer’s life is made a lot easier by the multitude of tools and libraries available that help implement change faster. As per Wordpress, plugins (known as ‘Ruby gems’) are fundamental to ongoing development, but the key difference here is that each new gem (with a little experience) can be easily deconstructed, understood and replicated. There is not the wild-west culture that so often makes Wordpress plugins unreliable, insecure and difficult to maintain.
The very sharing of the code is done in such a way as to guarantee future reliability. Instead of a simple copy and pasting of code into your own app, Rails programmers copy a reference to a piece of code. This is important because it allows programmers to enjoy the benefits of ongoing updates without the need for fundamental change of their own code. By simply updating the code reference in their own build, a Rails programmer can easily stay up to date with whatever the Rails community is doing.
Spaghetti code this ain’t
Ruby gems also stack up well compared to the PHP alternative. In PHP there is a culture of sharing untested or barely tested code snippets which can be rehashed by multiple users. Pasting code into a codebase this way can be dangerous because unlike the Ruby gems ethos of TDD and code referencing, there is no guarantee that the code will work properly in any scenario beyond the original. The worst-case scenario is a piece of spaghetti code working at first but then failing further down the line - once the product has already launched. Debugging can be extraordinarily difficult in cases where untested code has been imported from elsewhere and released into the wild.
Because it’s scalable, Ruby on Rails is a great foundation for a growing business that may suddenly have a spike in traffic and/or may require extra functionality in a hurry. Many good-looking, out-of-the-box templates have poorly written code which can only function adequately with low amounts of traffic (see our article on the pros and cons of website templates). A sudden increase in demand could make the site slow or could crash the server completely.
In terms of functionality, Rails has notoriously fast prototyping for creating web apps. This means it’s relatively easy to add new functionality to an existing website as and when you need to. Such low development time and development cost reduces the headache of having to keep a site up to date.
Did you know?
Twitter used Rails as it's core framework up until 2009 - serving upwards of 200 million users
Another underrated aspect of the Rails offering is the abundance of additional services that can be integrated in order to ease the ongoing management of a site, post launch. Heroku is one such service we use that manages the website environment. Heroku abstracts the hardware management and handles the integration of all the services a website uses (the web stack). This abstraction allows us to focus on creating great websites for the end user rather than worrying about the nuts and bolts. We’ll be discussing Heroku and other services we use on a daily basis more on this blog in future how we work articles.
“Ruby on Rails is slow” - myth busted
There is a common misconception about Rails being slow that we need to kick into touch.
The likes of AirBnB, Shopify and Github use Rails, which surely says something. These sites regularly see request rates north of 80,000rps (requests per second). To put that into perspective, a small-business website would be unlikely to see a rate of even 1rps.
There are a couple of plausible reasons for why some people think that Rails may be slow, but they stem back to poor application of Rails rather than flaws in the framework itself.
One reason relates to the ease of onboarding mentioned above, i.e. this attracts many beginners because they feel they can get somewhere quickly. If a site is built upon shaky foundations, performance can be variable. There is also the “convention over configuration” mantra that is part of the Rails philosophy. Again, for ease of onboarding, there are a number of default settings that are automatically selected. As a site evolves it might be necessary to change these settings in order to achieve quicker performance, but a beginner may fail to spot this and wrongly blame Rails for a poorly performing site. For more on performance check out Nate Berkopec’s book - The complete Guide to Rails Performance.
We’ll leave the final word to the Ruby on Rails founder, David Heinemeier Hansson:
“I’ll quote Albert Camus, who said ‘a novel is never anything but a philosophy expressed in images. And in a good novel the philosophy disappears into images.' This is true of programming languages and frameworks. When there is an underpinning philosophy and there are underpinning values, you can see them in the code. But like with novels it’s kind of hidden. Ruby put the big stick down that it [the philosophy] was going to be about programmer happiness."
As we know from experience, happy programmers make for happy clients!