• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

How do you design a data model for object oriented applications?

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

How do you design a data model for object oriented applications? Should the
data model be designed first, or should it be derived from the object model?

Please reply to this, if any one knows the solution.

Thanks,
Anil Sadineni.
 
blacksmith
Posts: 1332
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In a purely object oriented system, the object model and the data model are really the same thing, since the objects contain the data. As a result, the question doesn't really come up, since there's only one model to design.

If your system uses a persistent store like a database, I think it's often beneficial to design the data model used in the persistent store first, since consistency rules and such tend to be stricter for such data stores. The data model used in the object oriented part of the system doesn't have to be, and often shouldn't be, the same, though.
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Anil

I have faced similar confusion and what I think is-
ideally we can design OO and Data model in parallel.

The benefit doing this, as I see, is - none of your model becomes "design dependent" upon the other. OO doesn't get designed because something is desigened in some specific way in Data model and vice versa.

Now, this may lead to problems once we have designed both of them but we have to go through refactoring phase in design to see we would achieve what we want. THis means we might have to change certain things in OO model (I believe that Data model represents 'how data should be' and so its unlikely to change due to our OO model) but as far as we make sure they are not too much bound with each other in assumptions then its okay...

my 2 cents.

Regards
Maulin
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Robert Martin's excellent Agile Software Development book has a neat case study that builds a fairly complex payroll system entirely with data provided by unit tests. At the end, it is left to the reader to imagine a mapping to some database. Reading this was a profound experience to me, proving you can focus entirely on the object model and defer the database design to the end. Very cool.

It's tempting to say data models and object models can be or should be similar or even identical. Most modelling concepts (except inheritance) map fairly well between them and there are tools to generate Java objects from DDL. But if you think about your objects primarily as data structures you'll wind up with a very different design compared to thinking of them as behaviors with hidden data. The latter is likely to be much better OO. The former is common in stateless web apps with functional decomposition designs that just happen written in OO languages.
 
Stan James
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Forgot to recommend Scott Ambler's Agile Data site. Scott has some great papers and books on object-relational mapping for the real nitty gritty answer to your question.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic