Should we separate business logic and ORM mapping classes?

一首诗 newptcai at gmail.com
Tue Apr 14 05:08:03 EDT 2009


Hi,

( First, this is not a question about if we should use ORM.   It's
question for these who are already using it. )

Usually, I only use ORM, like sqlalchemy just as an abstraction layer
of
database.  So these mapping objects I wrote only contains data but not
behavior.

For example, if I have a class User, I would write another class
UserManager which with a methods like addUser, delUser.  But recently
I am thinking of moving these methods to User.  That sounds more OO
style.

What's your opinion?  What's the benefits and problems of this style?



More information about the Python-list mailing list