• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

experience in DDD-problem: evolving domain-model and migration of persistent data

 
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

in DDD a change of the domain-model is intended to react on changed business view or of improvements/extensions of domain-model in general.
as such i think the idea great, but can see problems with the already persisted data.

usually you try to connect the data-contents of the domain-model with the database in the way that you use an o/r mapper-tool like hibernate. this way restructuring the domain model implies that most likely the structure/schema or what so ever changes also.

but how do you cope with the complexity of already existing data which follow the old structure and are incompatible with the new better designed domain model?

has anybody had experience with the problem of keeping the persistent data up to date with the evolving model? what are the best practices for that? i think that the cost of migrating data to new structure (Extract-Transform-Load) is a hard problem which prevents many people to make design better and generally to think of an evolving design. how do you tackle this problem?

thanks.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd think that the *idea* behind using an OR mapper would be that the data model doesn't need to match the object model. If one of the models changes, you would basically just adapt the mapping, not necessarily the other model. (That probably won't always work - at least not with the tools I'm aware of.)

For changes to the database, you might get some ideas from http://databaserefactoring.com/
 
manuel aldana
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks ilja.

you are right, that class-model and mapping must not be close. but to make things better comprehensible, i try to get a mapping which is not too far away from the domain-model. especially when not only restructuring domain-model but adding new attributes to new evolved domain-classes and squashing them to an old o/r mapping things could be very difficult after a while.

so i think the mapping should evolve with the domain model too, especially in the beginning and some effort should maybe put to a kind of automatic refactoring domain-model ETL tool for the already existing data sake. but haven't tried out yet, still seeking for more (and maybe better) ideas

thanks for the link too. i had a rough look but at the first glance it did not mention the handling of an evolving domain-model with an o/r mapper. it merely went more into detail when it came to structure of relational databases.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by manuel aldana:

thanks for the link too. i had a rough look but at the first glance it did not mention the handling of an evolving domain-model with an o/r mapper. it merely went more into detail when it came to structure of relational databases.



As far as I remember, the book has much more information on this.
 
And then the flying monkeys attacked. My only defense was this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic