class structure proposal

  • Thread starter Grzegorz Stasica
  • Start date
G

Grzegorz Stasica

hi,

I've dillema with organizing my classes in my program. The program should
manage materials and their bill of materials (bom). So I've created one
class "Materials" which hold id of the material and ... yes it's bom.
The dillema is should bom object holds both parent code and child code?
How would you solve my problem. The snippet of my code is bellow:

class Material{
int materialid;
BOM bom;
}

class BOM{
Material parentmaterial; //schould I remove it since it's bound to
//the Material
Collection bomitems //collection of BOM Items since material can have
//more component than one
}

class BOMItem{
Material childmaterial;
int quantity;
}
 
R

rkm

I don't see that BOM supplies any usefull abstraction since
you could put the Collection of bomitems in the Material
class and eliminate the BOM altogether. It doesn't have an
identity, so there should be no need to manipulate a BOM
outside the use of the Material its in.

That would get you down to 2 classes, simplifying things.

Rick
 
D

Dale King

Grzegorz Stasica said:
hi,

I've dillema with organizing my classes in my program. The program should
manage materials and their bill of materials (bom). So I've created one
class "Materials" which hold id of the material and ... yes it's bom.
The dillema is should bom object holds both parent code and child code?
How would you solve my problem. The snippet of my code is bellow:


Since the BOM object could have many parents it does not make since to
maintain a parent code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,813
Messages
2,569,696
Members
45,486
Latest member
Deanna5597

Latest Threads

Top