Posted by: ahmedashfaque | March 13, 2016

A disparity between software design and database design

Software design is made using class diagrams. Database design is made using Entity Relationship (ER) diagram. In object relational database design, we either create a software design and the database design is created automatically and vice versa. Generally it is assumed that the ER diagram and the class diagram should be almost identical. But what challenges we can face when we try to do it? Let us discuss.

Suppose we have a class diagram where there is a parent class and 2 child classes of this parent class. How you are going to convert it into an ER diagram? If you will have a database table for the parent class and 2 other tables for the child classes? Even though it is possible to do so but if it will be a good ER diagram? One more problem is that the parent class may be an empty class (abstract class with no members).

In any case, suppose the parent class has class members then still the child class will have almost the same class members (which override the parent’s members). So essentially even though they are separate entities but will be used for processing very similar data. Keeping this similar data in separate database tables is not a good way to do it. Thus data coming from all parent and its child classes should be kept in only one table (if there are not too many differences among the classes. But if there are large differences among classes then they can not be related to each other and thus should not have any relation with each other in the first place!).

This means that even if the software design is in many dimensions, the database design should be flat. During software construction, you can dynamically load the right class which needs to be processed from among all the parent and child classes and then process the data and feed it into the database appropriately. This is the scenario which is most appropriate and widely used in the object oriented design world.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: