Click here to Skip to main content
15,925,444 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: Seating Selection System Database Design Pin
Eddy Vluggen15-Jul-09 11:04
professionalEddy Vluggen15-Jul-09 11:04 
QuestionStored Procedures Pin
CodingYoshi7-Jul-09 6:18
CodingYoshi7-Jul-09 6:18 
AnswerRe: Stored Procedures [modified] Pin
Eddy Vluggen7-Jul-09 8:48
professionalEddy Vluggen7-Jul-09 8:48 
GeneralRe: Stored Procedures Pin
CodingYoshi7-Jul-09 16:59
CodingYoshi7-Jul-09 16:59 
AnswerRe: Stored Procedures Pin
David Skelly9-Jul-09 2:54
David Skelly9-Jul-09 2:54 
AnswerRe: Stored Procedures Pin
Mycroft Holmes11-Jul-09 15:29
professionalMycroft Holmes11-Jul-09 15:29 
AnswerRe: Stored Procedures Pin
CodingYoshi13-Jul-09 17:05
CodingYoshi13-Jul-09 17:05 
QuestionORM tools in domain driven design? Pin
midix28-Jun-09 8:28
midix28-Jun-09 8:28 
Good day!

I am a student and I am doing a study on Object Relation Mapping tools and how they fit into various software design patterns and approaches. For now I have tried some tools and read about their weaknesses and strengths related to ModelViewController and n-tier design patterns and also have an experience with some projects. But lately I have found out about domain-driven design (which involves also a model-driven design at some point because domain objects together make a domain model). And I got a bit confused how does this all fit together with ORM and what is ORM role in those designs.

I have found this good article about practical example how to use MVC and domain driven design with Zend and PHP:

angryobjects.com/2009/03/30/writing-robust-php-backends-with-zend-framework/comment-page-1/#comment-1201

The author suggests keeping the domain model completely clean and unaware of underlying persistence. Only some ServiceLayer is needed to convert domain objects to/from persistence objects and as I understood this involves also CRUD operations.

But I want to know what happens if we introduce some ORM into this scenario. As I understand, the right way is to create domain model first and only after that think about how this model will be persisted with or without ORM. Let’s say, we have designed some domain model and now want to use ORM tool for easier persistence. ORM tool lets us generate some entity model and it is just logical that we’ll try to match this entity model with our domain model as closely as possible. But then we get some kind of duplication! We have a domain model with business logic in it and we have the same domain entities but with CRUD or various persistence attributes (maybe not visible but inherited from some base-class or interface). Then the question is - how good or bad idea is to merge our domain model with the ORM generated entities? When is it acceptable and allows us to say that we still have a good domain – driven design and when it is not acceptable because of too much “persistence aware” domain? Is it some trade-off thing going on here (clean domain entities versus duplicated entities)?
I found this article:
ibm.com/developerworks/java/library/j-pop1/

where they use some base classes and interfaces to implement common functionality in the domain model. But still the model entities contain some persistence awareness because of that inheritance. How good or bad is it from the point of view of clean domain model?

Also the same problem arises when we try to use Service Oriented Architecture. Our domain entities are not aware about any serialization so we cannot send them through XML straight away. It is so tempting to add serialization attributes in .NET classes to make them serializable. But I guess this again is not good idea because our domain model gets dirty with underlying technology dependent serialization information. Then again – we need to somehow hide this serialization but can we make it inherited? Of course developing it would get much more tricky that simply adding serialization attributes to the properties of the class because, for example, .NET serialization needs Order attribute for each serializable property to keep them in the right order – InfoPath forms do not tolerate any element order changes in XML schema. So we have a choice again – get domain dirty with serialization or create duplicate domain model entities which handle serialization.

This all got me really confused. What is the right use of ORM tools and serialization to avoid unnecessary duplication just to keep our domain model clean and technology independent?

And if we forget for a moment about that ServiceLyer but stick to the classical MVC - then where is the right place for CRUD operations when using ORM? Is it Controller or Model? But if ORM tool generates classes that do not manage persistence inside those classes then what would be the right way:
a) embed CRUD into model classes;
b) create some other classes which do the CRUD (but I gusee then it would be some service layer again)?

Also, if someone would want to develop some imaginary ideal ORM tool for domain-driven design model - I guess it would be some tool which allows us to create domain model and then match it straight with persistence without making the domain model itself aware of any persistence mechanisms at all. Is this even possible? Maybe you can give me some example of any ORM tool which is the most appropriate for domain-driven design?

Thanks.

modified on Sunday, June 28, 2009 3:44 PM

AnswerRe: ORM tools in domain driven design? Pin
Eddy Vluggen7-Jul-09 9:15
professionalEddy Vluggen7-Jul-09 9:15 
QuestionFirst attempt at OOD: How do I extend my design? Pin
Mark McArthey18-Jun-09 3:07
Mark McArthey18-Jun-09 3:07 
AnswerRe: First attempt at OOD: How do I extend my design? Pin
Mark McArthey18-Jun-09 6:01
Mark McArthey18-Jun-09 6:01 
GeneralRe: First attempt at OOD: How do I extend my design? Pin
led mike22-Jun-09 6:41
led mike22-Jun-09 6:41 
AnswerRe: First attempt at OOD: How do I extend my design? Pin
CodingYoshi18-Jul-09 21:18
CodingYoshi18-Jul-09 21:18 
QuestionMVC Pattern question Pin
Quake2Player16-Jun-09 7:43
Quake2Player16-Jun-09 7:43 
AnswerRe: MVC Pattern question Pin
led mike16-Jun-09 11:48
led mike16-Jun-09 11:48 
GeneralRe: MVC Pattern question Pin
Quake2Player16-Jun-09 12:16
Quake2Player16-Jun-09 12:16 
GeneralRe: MVC Pattern question Pin
led mike17-Jun-09 4:50
led mike17-Jun-09 4:50 
AnswerRe: MVC Pattern question Pin
Leslie Sanford18-Jun-09 7:50
Leslie Sanford18-Jun-09 7:50 
GeneralRe: MVC Pattern question Pin
Quake2Player18-Jun-09 8:17
Quake2Player18-Jun-09 8:17 
GeneralRe: MVC Pattern question Pin
Leslie Sanford18-Jun-09 8:21
Leslie Sanford18-Jun-09 8:21 
GeneralRe: MVC Pattern question Pin
Quake2Player18-Jun-09 8:30
Quake2Player18-Jun-09 8:30 
GeneralRe: MVC Pattern question Pin
Leslie Sanford18-Jun-09 8:59
Leslie Sanford18-Jun-09 8:59 
AnswerRe: MVC Pattern question Pin
CodingYoshi7-Jul-09 17:28
CodingYoshi7-Jul-09 17:28 
GeneralRe: MVC Pattern question Pin
Quake2Player7-Jul-09 17:37
Quake2Player7-Jul-09 17:37 
QuestionClient Server Protocol Definition - Best Practices Pin
Member 404718314-Jun-09 17:16
Member 404718314-Jun-09 17:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.