Hi,
I've just started a small web app, and I am using an ORM product for DB
access, which is what I have been doing for the last 5 years. In the
beginning I had my own solution, but after leaving the company I wrote it
for,  I did not take the code with me, and great products emerged for .NET
like llblgen.
The thing is, for a small project, it is almost inevitable for a developer
to quickly create a db schema, generate sql statements from the db design
tool, and create the db, which if followed by reverse engineering the db
with orm tools, and bind it to UI. It is the kind of thing that I've done
maybe a hundred times or more.
The thing is, when I start with use cases, and a domain model that does not
include any concerns for persistence, the results are different. The uml
diagram I'm looking at uses inheritence, design patterns etc, and if you do
not think about  persistence, the look of the code that uses this model is
quite clean. It is more maintainable too.
Now this is a clash between two different approaches, where domain info is
modelled first in db or in a domain model. The question is, what is the best
way to merge these approaches? I am really happy about using benefits of OO
in the domain model, but at the end I find myself writing a "manager" layer
which connects domain classes to orm generated classes.
I am not sure if ORM should be responsible for more than eliminating the gap
between relational paradigm and OO paradigm, and you see all these resources
referring to ORM classes as domain classes. Check out any OO design resource
or course, and you'll see that the modelling of a domain is rarely performed
in DB world, where schemas and allowed db types are your building tools.
Eclipse Modelling Framework seems to have a binding to Hibernate for
example, which is a clear indication of seperating domain model from ORM
classes, and I think I am in favor of this approach, for it allows me to do
the design based on OO approach, and it also gives the benefit of being able
to isolate myself from sql.
On the other hand, ORM based approach simply works! I think I'm more
inclined to accept ORM (generated) classes as domain classes when I'm under
time pressure and the app is small, and writing down the connecting layer
between domain and orm layers when I have more time and the project is
larger.
I'd love to hear what you think about this. How do you draw the line? Which
approach is common in your shop?

Cheers
Seref

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to