Orqi and MVC

By orqi

Orqi is an MVC Framework based loosely on Ruby and Struts. Taking some aspects from each. Orqi is a work in progress.

What is MVC?

MVC stands for model-view-controller and is a 40 year old design pattern intended to aid the organisation and maintainance of an application’s code. It does this by splitting the code up by responsibility. The most recognisable of these are the View and the Model.

The View is simply the user interface of the application and in a web project this means images, flash, css, javascript and of course html. There should be almost no logic in the View. It should basically be a set of screens that can receive or display data.

Next is the Model. This can be a bit tricky to get your head around because most books start talking about business logic and business rules when the Model is essentially the “things in your system” This means for example if your application has users in it, you will have a “users” tables in your database and a “User” class that represents one user. You can then use another class (usually a Mapper in MVC) to read and write stuff to the database.

The Controller then is the string that ties everything together. The incoming http request is passed to a Controller class, which validates or processes it in some way. It then calls an action in the model (ie a save, a delete, read a page of records) and then passed the data on to the View which then displays it.

Mandatory MVC Diagram

Tags:

Leave a Reply