Hi,

I started using Pylons with SQLAlchemy for quite a big project and I
want to organize sources and design this application as well as
possible.

So I want to use Data Mapper design pattern and with SQLALchemy it
looks that should be easy to do. Also it should be more flexible with
complicated business logic than using Active Record pattern.

I want to create some subpackages in model folder:
+ /model/logic - it is the place where all domain logic should be put
(classes which will be mapped to db tables and all other stuff which
coresponds to "business logic")
+ /model/mapping - it is the place for mappers from Data Mapper
pattern (save/delete/find in db), it is also place where sqlalchemy
mapping rules will be put.

Then, in actions in controllers I will try to delegate work to model/
logic and for e.g. at the end of action method call mapper to save
changes or something. But here I have some questions:

If I have some complicated things to do with logic and mappers where
to put this code? Is controller good place for it? For example when I
have complicated business transaction where I get something from db,
operate on data, save, again retrieve something else, make some
calculations in logic and then commit - where all this code should be
put?

I heard about the idea of thin controllers and fat models - but how to
achieve that when complicated logic is necessary? I can imagine that
creating simple CRUD apps will have thin controllers but what about
more sophisticated apps? Should be there another layer between
controller and model which will cope with this "complicated
transaction scripts"?

Maybe all of this questions make no sense because the idea of python
is not to copy patterns from e.g. Java enterprise applications - I
don't have so much experience - that's why I am asking for help :)

So, what are your experience with designing good Pylons+SqlAlchemy
application?

Thanks for help!

Cheers,
Kamil

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to