On Wed, Oct 7, 2009 at 8:06 AM, Eric Bauman <baumane@xxxxxxxxxxxxxx> wrote: > On 7/10/2009 7:25 PM, David Otton wrote: > >> 2009/10/7 Eric Bauman<baumane@xxxxxxxxxxxxxx>: >> >> Any thoughts would be much appreciated! >>> >> >> One observation. "Model" isn't a synonym for "Database Table" - models >> can be anything that encapsulates business logic. Requiring all your >> models to inherit from Model is probably a bad idea. >> > > Thank-you for responding. > > Out of curiosity, why is this a bad idea? Is it also bad for views & > controllers? > > > Cheers, > Eric > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > It's about responsibilities. A Model should encapsulate business logic, and business logic and persistence has nothing in common. Maybe you can code a loader/persister object and let your models rely on it to handle the instances? This way you can decouple you business logic from the data persistence, allowing you to change one of them without introducing bugs into the other. Suppose you need to change your Database engine => change the loader/persister. You need to add/remove/modify some new rules in your business logic => change the models Why don't you allow the view to use the model? This way you have... # the controller is responsible to instantiate the model(s) and view(s) # the model is responsible for the business logic # the view is responsible for the presentation -- Martin Scotta