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

(10-29-2014, 08:50 PM)jlp Wrote: I tend to agree with Hobbes. Part of what I try to get through to my students is proper separation of concerns. Controllers are for handling usecases, models encapsulate data sources, and views present stuff for human consumption. Taken to an extreme, we end up with a Model-View-Adapter pattern, where the view has no idea where data comes from - that is up to the controller.

I give my students a small set of "golden rules" at the beginning of my course...

If a model generates HTML, you are "fired".
If a view is aware of the origin of data (eg RDB), you are "fired".

In this context, "fired" means 20% off your grade for a lab or assignment, no questions and no mercy. You also get "fired" if your webapp somehow triggers a PHP error visible to the user.

This is a simplisitic view, and doesn't work or apply in absolutely every case, granted, but it sure drives home the point of MVC Big Grin

Man, there are a lot of 'programmers' out there that would be fired. Good thing for enforcing the rules. You should make sure they get fired if they don't escape SQL queries too ^^
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