Previous Page
Next Page

Sensible MVC

Except to make a point about Ruby's high-level design as a Model-View-Controller (MVC) architecture, it's impossible to do this framework justice in a short introduction.

MVC is a design pattern that separates the three components of an application into different software modules or units of code. The purpose of this division is to allow the components to evolve independently, to decouple software objects that have different roles, and to ensure that changes to one module do not inadvertently affect other modules. The model represents the application's data or state, such as database information; the view is what the user sees, as in a web page or user interface (UI); and the controller is the part of the application that responds to the user's interaction (for example, handling keyboard events and deciding which view to display).

RoR explicitly uses MVC in the design of its runtime code and directory structure. This is reflected in its subframeworks: Active Record, which handles the model, and Action Pack, which comprises the Action Controller and Action View pieces. (According to the RoR documentation, these two are bundled together because of their "heavy interdependence.")

The hacks in this chapter attempt to summarize the pertinent aspects of RoR's tools and structure. However, RoR is a complex beast. The best thing to do is to install it on a development or prototype machine and give it a ride.


Previous Page
Next Page