Welcome Guest, Not a member yet? Register   Sign In
Models, where, when and why?
#6

(This post was last modified: 10-24-2014, 10:18 AM by John_Betong.)

I think models are best treated as a black-box written by third-parties.

From the View a user requests certain information which is Routed to the relevant Controller. The request is then sent directly to the Model.

The Model's task is to sanitize and interpret the request then return data in a specific agreed format. The returned data could even be Null or an empty array.

Controller just accepts the Model's data, makes absolutely no tests and/or changes and just passes the Model's data to the View.

Before I forget!
When returning data from a Model (also applies to Controllers and Libraries) it is tempting to Html format the data with size, bold, colours, etc. This is remarkably easy and seems such a good idea at the time but later becomes an onerous task to make changes to the View. It becomes necessary to sift through reams of Controller, Library of Model's script to find the offending output which is creating the View havoc!

The time saved by formatting in the wrong place is less than negligible and even lesser if the data is cached Smile

I have the T-shirts!!!
Reply


Messages In This Thread
Models, where, when and why? - by Thyrosis - 10-24-2014, 12:03 AM
RE: Models, where, when and why? - by Rufnex - 10-24-2014, 02:39 AM
RE: Models, where, when and why? - by navotjer - 10-24-2014, 04:10 AM
RE: Models, where, when and why? - by InsiteFX - 10-24-2014, 04:44 AM
RE: Models, where, when and why? - by kilishan - 10-24-2014, 08:17 AM
RE: Models, where, when and why? - by Thyrosis - 10-25-2014, 02:16 AM
RE: Models, where, when and why? - by John_Betong - 10-24-2014, 10:04 AM
RE: Models, where, when and why? - by Hobbes - 10-29-2014, 06:41 AM
RE: Models, where, when and why? - by jlp - 10-29-2014, 08:50 PM
RE: Models, where, when and why? - by albertleao - 10-30-2014, 11:41 AM
RE: Models, where, when and why? - by InsiteFX - 10-30-2014, 04:28 PM
RE: Models, where, when and why? - by Thyrosis - 11-01-2014, 01:27 AM
RE: Models, where, when and why? - by alroker - 11-16-2014, 11:55 AM
RE: Models, where, when and why? - by Thyrosis - 11-18-2014, 05:51 AM
RE: Models, where, when and why? - by RobertSF - 11-20-2014, 08:19 PM
RE: Models, where, when and why? - by veedeoo - 11-17-2014, 09:04 PM
RE: Models, where, when and why? - by bclinton - 11-17-2014, 09:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB