repeated functionality

Posts   
 
    
yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 14-Apr-2006 01:08:35   

hiya,

I have a project where there are 2 entities that are very similar

"delivery" and "return"

A delivery comprises all of the products that a driver has delivered on a given day. A return comprises all of the products that a driver has not sold on a given day.

Both entities are related to products in the same way. Indeed, the only difference between delivery and return is the names of some of their fields..the datatypes etc are the same.

In the project, I have more or less repeated the code for both entities. However, I now think that it might have been possible to sub type the entites.

Has anyone taken a similar approach?

cheers,

yogi

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 14-Apr-2006 09:04:09   

Yes it depends on whether they are semantically related or equal or not. Actually there are many approaches that can be taken for this situation.

One of them, if both tables have the same relations with other tables, you may join them in one table, and using a type column you can differentiate between them (unifyin column name won't be a big problem I guess)

If they have few columns not in commen, then you might set the common columns in a supertype table, then make a subtype table for each type containing the un-common columns.

If they are not semantically related or if you don't have time to go back and fix your design, and they are already working fine, then leave it as it is (if it ain't broke, don't fix it) And consider the correct design in your next projects.

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 14-Apr-2006 11:19:04   

hiya Walaa, Yes, it works and I'm not going to try and re-design at this stage. (I'm still at the stage where I need more llblGen experience to understand fully what is happening)

The project is more of a llblGen learning experience.

One of them, if both tables have the same relations with other tables, you may join them in one table, and using a type column you can differentiate between them (unifyin column name won't be a big problem I guess)

I suspected that I might have been able to do something like that..Only AFTER I had gone thru the pain of replicating a lot of stuff.

Ta for the reply, I'm hopeful for the future.

sunglasses

yogi