Sunday, September 6, 2009

Workshop 2

Model View Controller
The Model View Controller(MVC) design pattern was first described in 1979 by Trygve Reenskaug while working at Xerox on Smalltalk. MVC is not a new syntax construct like an if statement or a data type like an array or int but more a way of looking at how to structure programs and divide the parts up in a logical and useful way.

Following MVC guidelines has been shown to organize applications in a way that makes them easy to manage and maintain. After working with the MVC pattern for a while you will grow to see the benefits that the division of labor produce. Rails is a strict MVC frame work.

Model

The Model is all about the data. This includes getting the data in and out of the data store. The scaffolding we set up in part one gives us the four basic operation of using a data store Create, Read, Update and Destroy.

View

The View renders the Model in an interactive displayable format that takes the data in the Model and paints it up on the screen for you to see and interact with.

Controller

The Controller responds to events communicating with the Model and the View. This is like the Main loop in a state machine waiting for events like user actions or Model data to show up and reacting as the program dictates to those events.

References:

The Model-View-Controller (MVC)
MVC stands for Model-View-Controller

No comments:

Post a Comment