Django provides a great way to separate models and views, and even 
pre-populates the project tree with directories named models and views.  
But what about separating models and controllers, that is, separating 
the specific database representation of an object from all of the 
"business logic" needed to manipulate the object?

I've seen two patterns in use, and neither is completely satisfactory.  
I'm wondering if there are possibilities I've overlooked.

The first technique is to put all of the logic in the model class.  This 
leads to large model classes, and combines all of the field lists with 
the logic to manipulate them.

The second technique is to leave the model classes as bare as possible 
(basically just Field declarations), and create a separate module full 
of helper methods that has all the logic.  This means the objects don't 
manipulate themselves, and you have to go back to non-OO techniques of 
passing passive data structures into un-classes functions.

Is there some way to put the model and the logic in two separate places 
but somehow end up with an object class with real methods?  Am I making 
any sense?

-- 
Ned Batchelder, http://nedbatchelder.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to