MVC Controller Design Pattern

 

MVC which stands for Model-View-Controller is a pattern I have been intrigued with lately. I first got introduced to the concept when I began experimenting with Ruby on Rails. It enforces a separation of responsibility.

The view should not need to know what the database is. It should focus only on what it needs to display content to the screen. The model contains database specific code to perform the basic CRUD options (Create, Read, Update, and Delete). Lastly the controller contains business logic and bridges the gap between the view and model.

I found that separating code into these 3 layers is not always a straight-forward process, but it does have its long term benefits.

  • easier to maintain due to things being abstracted away and not all clumped together
  • code is reusable because each layer is not tightly coupled to each other
  • changing databases is easier due to all database access being in one area not throughout all pages
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Add to favorites
  • Design Float
  • DZone
  • email
  • FriendFeed
  • PDF
  • Propeller
  • Reddit
  • RSS
  • StumbleUpon
  • Twitter

Related posts:

  1. MVC: A Beginner’s Guide
  2. Networking
  3. CRAP Design actually good?
  4. CodeIgniter PHP Framework


Written by Brenley Dueck

 

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
connect with me!