For smart people with non-IT backgrounds: If you want to understand Ruby on Rails, this article is for you. Of course, only disciplined practice will turn a novice into an expert. This piece will make a novice conversant.
Why Ruby on Rails?
Ruby on Rails helps developers write better web apps in less time with fewer errors. Time is money. Businesses measure results in currency. Rails enables developers to deliver.
Ruby: The Language
Ruby on Rails consists of two main components: A programming language called Ruby, and a Web development framework called Rails. It is customary to refer to “Ruby on Rails” as simply “Rails.”
Ruby is an object-oriented language. Many developers believe that software written in object oriented languages is easier to maintain. Companies benefit from the object oriented approach because easier maintenance means a longer, revenue-generating lifespan for a given code base. Wikipedia’s object-oriented programming article has more details.
Rails: The Framework
Rails is a framework written in Ruby. One of the best ways to define Rails is to describe the problem that it solves.
Creating a web app can be time-consuming because of all the details that must be tracked and managed. How does the app connect to the back-end database? How does information get pulled from the database for display on the screen? As users, we take well-built web apps for granted. However, every element of every page must be clearly defined and thoroughly tested before users visit the site. Every text box, every drop-down arrow, every data field (credit card number, expiration date, etc.) must be programmed and thoroughly tested before any users visit the site.
Before Rails, developers had to make every decision from scratch for each new web app. It was like having to invent the wheel every time you assembled a bicycle. What a waste of time! It’s much smarter to invent the wheel once. And then you can use variations of that wheel for other vehicles like automobiles and tractors.
Gems are Libraries
If you’ve spent any time around Rails developers, you may have heard the term “gem” in conversation. Gems are libraries of functions that get used over and over from one code base to the next. Gems are one reason why Ruby developers are so productive. We only invent the wheel when we have to. Otherwise, we’ll use a gem that has the wheel functionality that we need.
Gems enable Ruby developers to spend less time re-inventing the wheel and more time writing code that is specific to the business problem at hand.
By the way, Rails is a gem.
Rails is a Gem?
That’s right, Rails is a gem. Rails was extracted from a web-based project management application called Basecamp, by 37signals. After writing the code for Basecamp, David Heinemeier Hansson (the developer) realized that he and his team might want to write other applications for the web with behavior similar to Basecamp. So DHH extracted the non-Basecamp-specific code from the app, bundled it into a gem, and called the gem Rails.
Imagine if you were the first person to invent The House. While inventing the house, you invent new features like doors, windows, and water faucets. After building the first house, you decide to build more houses. You save time on future houses by using some of your inventions from the first house: Doors, windows, and water faucets.
Rails Automates Repeated Tasks
Rails automates time-consuming, repetitive tasks (things that were once done manually) so that developers can focus on solving problems for your business.
Here’s an example from another profession. Can you imagine an accountant’s life without a spreadsheet like Microsoft Excel? Maybe you don’t have to imagine! You might recall the days of paper spreadsheets, pencils, and 10-key hand-cranked calculators.
Rails is to software developers as electronic spreadsheets are to accountants. Both tools make their respective professionals more productive by eliminating repetitive tasks.
Rails Has Its Limits
Rails and spreadsheets both eliminate grunt work. At the same time, they both have limitations. Neither is a replacement for rational thought. For example, knowing how to use a spreadsheet won’t make you an accountant because you still need to understand tax law and discounted cash flow analysis. Likewise, a developer who knows Rails must also understand object oriented programming and relational database theory in order to create a workable piece of software.
If you would like to dive into the details of Rails, you might want to:
- Read a book. WisdomGroup recommends the Ruby on Rails Tutorial by Michael Hartl. Hartl goes into greater depth on all of the subjects mentioned in this post.
- Join a user group. ChicagoRuby hosts multiple free events every month.
- Watch some videos. Railscasts and Peepcode have proven popular over the years.
- Attend a conference. WindyCityRails is the one that we run, and there are several solid Ruby and Rails conferences around the world.
WisdomGroup builds web and mobile apps. If you have an idea for an app in a current or future business, we invite you to contact us via the form below.
About the Blog Author
Ray Hightower is president of WisdomGroup, creators of outstanding web-based software. WisdomGroup leads the open source user group ChicagoRuby, and we created conferences for Ruby on Rails (WindyCityRails) and the Internet of Things (WindyCityThings). For more information, visit WisdomGroup.com.