If you've been looking for a good overview on Rails, look no further. This three-part series will help you understand this popular framework. It is excerpted from chapter one of the book Beginning Rails: From Novice to Professional, written by Jeffery Allan Hardy, Cloves Carneiro Jr. and Hampton Catlin (Apress, 2008; ISBN: 1590596862).
Rails is a web application framework for the Ruby programming language. Rails is well thought out and practical. It will help you build powerful web sites quickly, with code that’s clean and easy to maintain.
The goal of this book is to give you a thorough and complete understanding of how to build dynamic web applications with Rails. This means more than just showing you how to use the specific features and facilities of the framework, and more than just a working knowledge of the Ruby language. Rails is quite a bit more than just another tool. It represents a way of thinking. To completely understand Rails, it’s essential that you know about its underpinnings, its culture and aesthetics, and its philosophy on web development.
If you haven’t heard it already, you’re sure to notice the phrase “the Rails way” croppingup every now and again. It echoes a familiar phrase that has been floating around the Ruby community for a number of years: “the Ruby way.” The Rails way is usually the easiest way—the path of least resistance, if you will. This isn’t to say that you can’t do things your way, nor is it meant to suggest that the framework is constraining. It simply means that if you choose to go off the beaten path, don’t expect Rails to make it easy for you. If you’ve been around the UNIX circle for any length of time, you might think that this idea bears resemblance to the UNIX mantra: “Do the simplest thing that could possibly work.” You would be right. This chapter’s aim is to introduce to you the Rails way.
The Rise and Rise of the Web Application
Web applications are increasingly gaining in importance. As our world becomes more and more connected, more and more of what we do is on the web. We check our email on the web, and we do our banking on the web. We take courses, share photos, upload videos, manage projects, and connect with people all over the world from the comfort of our browsers. As our connections get faster, and as broadband adoption grows, web-based software, and similarly networked client/server applications, are poised to displace software distributed by more traditional (read, outdated) means.
As consumers, web-based software affords us greater convenience, allowing us to do more from more places. Web-based software works on every platform that supports a web browser (which is to say, all of them), and there’s nothing to install or download. And if Google’s stock value is any indication, web applications are really taking off. In fact, the change in the web has been so dramatic in recent years that its current incarnation has been dubbed Web 2.0. All over the world, people are waking up to the new web and the beauty of being web-based. From email and calendars, photos and videos, to bookmarking, banking, and bidding, we are living increasingly inside the browser.
Due to the ease of distribution, the pace of change in the web-based software market is fast. Unlike traditional software, which must be installed on each individual computer, changes in web applications can be delivered quickly and features can be added incrementally. There’s no need to spend months or years perfecting the final version or getting in all the features before the launch date. Instead of spending months on research and development, you can go into production early and refine in the wild, even without all the features in place.
Can you imagine having a million CDs pressed and shipped, only to find a bug in your software as the FedEx truck is disappearing into the sunset? That would be an expensive mistake! Software distributed this way takes notoriously long to get out the door because before a company ships a product, it needs to be sure the software is bug-free. Of course, we all know there’s no such thing as bug-free software. And web applications are themselves not immune to these unintended features. But with a web application, bug fixes are easy to deploy.
When a fix is pushed to the server hosting the web application, all users get the benefit from the update at the same time, usually without any interruption in service. That’s a level of quality assurance you just can’t offer with store-bought software. There are no service packs to tirelessly distribute and no critical updates to install. A fix is often only a browser refresh away. And as a side benefit, instead of spending large amounts of money and resources on packaging and distribution, software developers are free to spend more time on quality and innovation.