A framework extracted from a real product
Ruby on Rails is not born in a research laboratory or as an academic exercise. David Heinemeier Hansson (DHH) extracts it from the codebase of Basecamp, a project management application developed by the company 37signals. The idea is straightforward: production-tested code, generalised and released as an open source framework. Version 1.0, published in December 2005 under an MIT licence, consolidates an approach to web development that will profoundly influence every framework that follows.
Rails is written in Ruby, an object-oriented language created by Yukihiro Matsumoto that favours code readability and expressiveness. The choice of Ruby is deliberate: its syntactic flexibility allows Rails to create a DSL (domain-specific language) that makes code almost readable as prose.
Two foundational principles
Rails is built on two principles that define its identity. Convention over Configuration (CoC) means the framework assumes sensible defaults: if a table is named users, the model will be User, the controller UsersController, the views in the views/users directory. The developer writes code only when deviating from the convention, eliminating hundreds of lines of XML configuration typical of Java frameworks of the era.
Don’t Repeat Yourself (DRY) establishes that every concept must have a single authoritative representation in the system. Migrations define the database schema in Ruby and track its evolution over time. Active Record implements Martin Fowler’s pattern of the same name: each model is a Ruby class that maps a table, each instance a row, with methods for queries, validations and relationships.
Scaffolding and productivity
The scaffold generator creates in a single command a model, controller, views, migration and routes for a complete CRUD entity. It is not production-ready code as-is, but a working starting point that eliminates initial boilerplate. RESTful routing maps URLs to controller actions following HTTP conventions.
The development cycle is rapid: modify the code, reload the browser, changes are immediately visible without recompilation or deployment. The built-in WEBrick server allows starting development without configuring an external application server.
Impact on the ecosystem
Rails demonstrates that a framework can be simultaneously opinionated and productive. The speed with which it is possible to go from an idea to a working application raises the bar for every web framework, regardless of language. The CoC and DRY principles become universal references in framework design.
Link: rubyonrails.org
