Stuck between 2 worlds: OOA and Database...

Stuck between 2 worlds: OOA and Database...

Old forum URL: forums.lhotka.net/forums/t/3715.aspx


AAKLebanon posted on Monday, October 15, 2007

Hi everybody...

Each time I think that I have translated from the data centric world to the OO world, I found my self lost...

When I begin creating my business object, I always say : "there is no database, there is no database...", but simply I can't !

I don't know who must be created first ? who must lead the creating of the other ?

I know that in a specific time, I will deal with SQL statements in my business objects, I know that my properties will be bounded to columns in the database (or simply not ?), what about persisting calculated columns (for performance reasons) ?...

I hope that someone will share his idea with me, this is a general discussion...

ajj3085 replied on Monday, October 15, 2007

Here's what I've found helpful.  I create use cases, based on what my customers / users say they need the application to do.  I create the business objects to focus on acomplishing that task.  Don't think about the database at this point, its not necessary.  Making the process more formal, by creating class diagrams and such has helped me.  Once you think you have a good object model, try writing some unit tests to see how your users would interact with the objects (basically, what calls the UI would make on behalf of the user). 

After all the is done, then you can start thinking about how to actually store the data.  Don't change your BOs for any reason while you're doing the design of the database.  It is hard, but you need to keep at it to retrain your brain.  Reading Rocky's chapter on building an actual business layer on Csla is a good thing to do once in a while too.

Copyright (c) Marimer LLC