• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MVC best practices, to display the models

#11
[eluser]Dready[/eluser]
The scenario is : I'm currently implementing CRUD (+display) in my ORM class. To enable this : I have the "base" class dealing only with database stuff (fectching, updating,...) and I'm coding a subclass of this base class for CRUD stuff. Perhaps because I'm a lazy guy, and perhaps because it's simplest, I'm confronted to this dilemna : if I respect the MVC rules, I have to duplicate the processing : once for my model to output itself as an array, and once for the controller or view, that parses the array and sends back HTML.

Because it's duplicate processing, and because it duplicates code too, I came to a solution I find elegant, that is a function that, without argument, returns the array, and with an argument (more or less a hash of templates) directly returns HTML.

But MVC design doesn't strictly allow this, and I'm wondering if it's only bad in theory (in this case I don't care), or if that could lead me to problems when developing my "business" classes, that will extend the "orm crud" class.


Messages In This Thread
MVC best practices, to display the models - by El Forum - 09-20-2008, 05:06 AM
MVC best practices, to display the models - by El Forum - 09-20-2008, 06:50 AM
MVC best practices, to display the models - by El Forum - 09-20-2008, 10:47 AM
MVC best practices, to display the models - by El Forum - 09-20-2008, 10:56 AM
MVC best practices, to display the models - by El Forum - 09-20-2008, 11:24 PM
MVC best practices, to display the models - by El Forum - 09-20-2008, 11:57 PM
MVC best practices, to display the models - by El Forum - 09-21-2008, 12:22 AM
MVC best practices, to display the models - by El Forum - 09-21-2008, 02:56 AM
MVC best practices, to display the models - by El Forum - 09-21-2008, 03:21 AM
MVC best practices, to display the models - by El Forum - 09-21-2008, 03:25 AM
MVC best practices, to display the models - by El Forum - 09-21-2008, 11:40 AM
MVC best practices, to display the models - by El Forum - 09-21-2008, 12:06 PM
MVC best practices, to display the models - by El Forum - 09-21-2008, 12:23 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.