Entity-Relationship Diagrams and OOSource: comp.objectDate: 22-Dec-99
![]() ![]()
![]() ![]() [...] Whenever I try to draw class diagram I end up drawing Entity relationship diagram. [...]
![]() ![]() One of the deepest truths about object orientation is the fact that objects are about behavior rather than data. It is very unfortunate that it is hard for people who come from a data modeling background to really grok this part of OO. As an example, consider dates. A data modeler could model a date as a value object which holds month, day, and year. You can use such objects all over your application and never get to some of the higher behavioral abstractions which make OO so useful. For instance, if you look at how dates are used, you may discover that it makes more sense to have a timeperiod object (after all, a date consists of 24 hours, it is a period) which has an "includes" method that you can use to determine whether one timeperiod falls into another. The first thing that I would recommend is that you start to pay more attention to the "behaviorists" in OO: Booch, Robert Martin, Rebecca Wirfs-Brock, since you know that you see things as data right now. Also, read about CRC cards and start to use them rather than UML for a while. You are much less likely to end up with a data driven design this way.
![]() ![]() When you focus and draw entities and relationships say your studying the "static structure". When you are working with sets of responsibilities and looking for similar behaviors --- then you are doing the "dynamic structure". They are both necessary, and each helps the other. For example one "GRASP" pattern is to assign a responsibility to the "Expert": assign the function to the entity that holds the data. This works if you have an ER on hand with attributes. To stretch in the direction of dynamics, as an exercise you could take some non-risky and simple projects/problems and try doing CRC on it. Or Coad's colored post-it note technique. ![]() ![]()
Alistair Cockburn,
An Open Letter to Object Technology Newcomers
Rebecca Wirfs-Brock, Brian Wilkerson, Lauren Wiener,
Designing Object-Oriented Software
Robert C. Martin,
Designing Object Oriented C++ Applications Using UML
Grady Booch, Ivar Jacobson, James Rumbaugh,
The Unified Modeling Language User Guide
Craig Larman,
Applying UML and Patterns
Peter Coad, Eric Lefebvre, Jeff De Luca,
Java Modeling In Color With UML
![]() |