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).
Introducing the Rails Framework - The Web Is Not Perfect (Page 2 of 4 )
As great a platform as the web is, it’s also fraught with constraints. One of the biggest problems is the browser itself. When it comes to browsers, there are several contenders, all of which have a slightly different take on how to display the contents of a web page. While there is a movement toward unification, and the state of standards-compliance among browsers is steadily improving, there is still a lot left to be desired. Even today, it’s nearly impossible to achieve 100% cross-browser compatibility. Something that works in Internet Explorer won’t necessarily work in Firefox, and vice versa. This lack of uniformity makes it difficult for developers to create truly cross-platform applications, as well as harder for users to work in their browser of choice.
Browser issues aside, perhaps the biggest constraint facing web development is its inherent complexity. A typical web application has dozens of moving parts: protocols and ports, the HTML and CSS, the database and the server, the designer and the developer, and a multitude of other players, all conspiring toward complexity.
But despite these problems, the new focus on the web as a platform has meant that the field of web development is evolving rapidly and quickly overcoming obstacles. As it continues to mature, the tools and processes that have long been commonplace in traditional, client-side software development are beginning to make their way into the world of web development.
The Good Web Framework
Among the tools making their way into the world of web development is the framework. A framework is a collection of libraries and tools intended to facilitate development. Designed with productivity in mind, a good framework will provide you with a basic but complete infrastructure on top of which to build an application.
Having a good framework is a lot like having a chunk of your application already written for you. Instead of having to start from scratch, you start with the foundation already in place. If there is a community of developers using the same framework, you have a community of support when you need it. You also have greater assurance that the foundation you’re building upon is less prone to pesky bugs and vulnerabilities, which can slow down the development process.
A good web framework can be described as follows:
Full stack: Everything you need for building complete applications should be included in the box. Having to install various libraries or configure multiple components is a drag. The different layers should fit together seamlessly.
Open source: A framework should be open source, preferably licensed under a liberal, free-as-in-free license, like BSD or MIT.
Cross-platform: A good framework will be platform-independent. The platform on which you decide to work is one of personal choice. Your framework should remain as neutral as possible.
A good web framework will provide you with the following:
A place for everything: Structure and convention drive a good framework. In other words, unless a framework offers a good structure and a practical set of conventions, it’s not a very good framework. The idea is that everything should have a proper place within the system. This eliminates the guesswork and increases productivity.
A database abstraction layer: You shouldn’t have to deal with the low-level details of database access, nor should you be constrained to a particular database application. A good framework will take care of most of the database grunt work for you, and it will work with almost any database out there.
A culture and aesthetic to help inform programming decisions: Rather than seeing the structure imposed by a framework as constraining, see it as liberating. A good framework encodes its opinions, gently guiding the developer. Often, a difficult decision has been made for you by virtue of convention. The culture of the framework helps you make fewer menial decisions and helps you to focus on what matters most.