View Single Post
Old 12-10-2009, 09:21 PM   #15 (permalink)
sketchMedia
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Quote:
Originally Posted by Tanax View Post
You should probably have taken your coffee before replying xD
I didn't say you should access the database via the controller. I just said you CAN, and that the use of models isn't limited to database handling.

I "proved" this by saying that otherwise you wouldn't be able to access the database via the controller. Because if models would be limited to database handling, then you should be forced to use models for the database handling, and controllers wouldn't allow you to access the database. But controllers do allow this thus models aren't limited to database handling.
Yea, its not a good idea me replying to threads after just comming out of a meeting and a lack of coffee, I'll remember that in the future! I still maintain that the idea of accessing the DB from the controller makes me feel a little edgy, it will end up in a crawling horror of an application!

Quote:
Originally Posted by ETByrne
You both make valid points, but keep in mind I was just generalizing for the sake of simplicity. Also remember that there are different variations of MVC, but again, that just makes it all the more complicated for someone trying to learn it at first. :)
Indeed! Its probably one of the hardest patterns to learn because it is interpreted by many people in many different ways. The way I do it is the way I found it most useful for my own projects, I found that lumping most of the logic in models made it alot easier for me in a number of ways (reuse, unit testing etc).
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote