Overview of MVC

Kayla Knight has written a great overview of  the Model-View-Controller (MVC) Coding Structure over at OnExtraPixel. The article covers the basic idea behind the structure and how you could create your own bespoke MVC.

My own view of MVC is:

  • Controllers receive the requests, ask models to do all the heavy lifting and directs the views
  • Models receive, validate, and process all data. Each model should represent a thing e.g. an account, user etc. Sometimes things can have multiple tables. The model should deal with the session and validation work too. This makes the code much more reusable and more representative of business rules being uniformly enforced.
  • Views get pushed out to the users

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s