What is data-centric thinking/design?

What is data-centric thinking/design?

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


tna55 posted on Wednesday, October 17, 2007

Hi,

When we say that data-centric thinking is not good way to design business applications, what does 'data-centric' means?

In other words if I am thinking in 'X' way and designing my applications in 'Y' way then that is the data-centric way of doing things. What is 'X' and 'Y' here?

Tahir

JonStonecash replied on Thursday, October 18, 2007

Thew most extreme form of "data-centric" design is to say "that if it is in the database, it must be in the object."  Even if the problem at hand does not need that data.

Let me give you an example.  Suppose that I have a database that has a lot of demographic data as well as purchasing data.  My problem for the moment is to figure out how to market some add-ons to families what have purchased an XBox recently.  What the problem needs need is a list of families with the names and ages of the parents, address (including the ZIP+4 data), family income, date of the purchase of the last XBox, and the number of children.  All of that data is in the database, scattered through several inter-related tables.

The data-centric approach would be to generate objects for each of these tables.  The application would navigate through these objects to perform its work.  This is workable; lots of applications are written this way. 

The behavior-centric approach would create a single object that held just the data needed for the application.  Somewhere in the application (in a single place, closely guarded) would be the logic to map the between the contents of the database and the contents of the object.  But you say, this mapping logic is additional work.  Right, you are.

Why would I do this "extra" work?  One reason is that the logic of the application (once this work was done) would be simpler.  There would be very little, if any, navigation.  The intent of the application would be very obvious to anyone reading the code.  Two, the application would be relatively immune to changes in the database.  Three, the application would perform better because it is not bringing so much informaton back from the database; the application needs to know that the parents are married but does not need to know when or where or who performed the ceremony.

Having said all of this, I readily admit that it is often easier (given code generation tools) to bang out a quick data-centric object model and program away.  The real payoff with the behavior-centric approach usually comes later as the application evolves.  The clarity of the logic is a real plus at that time.

Jon Stonecash

tna55 replied on Thursday, October 18, 2007

Hi Jon,

Many thanks for your reply.

I agree with you and I have started to realize that what people on this thread call data-centric approach is something I have done in past as well. It gets the application on its feet very quickly however very soon it falls apart due to maintenance problems. Most importantly, what has happened with me, is that it is difficult for the application to grow because the code is so mixed up (due to each class doing more than one task).

Tahir

tna55 replied on Thursday, October 18, 2007

Jon,

Would you be able to give me some sample code for the mapping of database and contents of objects?

I would really appreciate it.

Tahir

Copyright (c) Marimer LLC