Abra C. [email protected] wrote:
I don’t have much experince in using any web based framework.
I have a few questions. I understand that ruby on rails is an open
source web application framework written in Ruby that closely follows
the Model-View-Controller (MVC) architecture. Could someone explain the
MVC architecture in simple terms?
Yes. See below.
To use the rails framework, does one need to have knowledge of the ruby
Model-view-controller is an old, tried-and-true pattern for separating
the functionality of GUI programs into three areas:
(1) The underlying data and the management thereof. (Model)
(2) The visible manifestation; the user interface. (View)
(3) Mediation between (1) and (2). (Controller)
So basically MVC just means that visible form and underlying content are
separated. This is always a good principle because it means you can
change one without necessarily changing the other. If my view is
expecting to display the value of a variable called @lastname, it
doesn’t matter to it how @lastname is determined. If my model is a
database containing a table “people” containing a field “lastname”, it
doesn’t care how (or whether) that data is displayed. The controller’s
job is to ask the model for the data and put it into the @lastname
variable so the view can display it; it is the mediator.
Rails literally separates model, view, and controller into three
different pieces of the program you write. It enforces MVC for you by
the sheer physical structure of a Rails app, as well as by the
underlying behavior. m.