Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > class structure proposal

Reply
Thread Tools

class structure proposal

 
 
Grzegorz Stasica
Guest
Posts: n/a
 
      07-08-2003
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;
}

 
Reply With Quote
 
 
 
 
rkm
Guest
Posts: n/a
 
      07-08-2003
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

Grzegorz Stasica wrote:
> 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;
> }
>



 
Reply With Quote
 
 
 
 
Dale King
Guest
Posts: n/a
 
      07-08-2003
"Grzegorz Stasica" <(E-Mail Removed)> wrote in message
news:bednb2$hps$(E-Mail Removed)...
> 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.
--
Dale King


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Proposal: Allow using injected class name when template name is in scope Johannes Schaub (litb) C++ 3 09-10-2010 05:59 PM
Feature Proposal: Explicitly declare a struct (or class) as POD jmucchiello C++ 9 08-26-2009 07:43 PM
Proposal for signed/unsigned modifier in class declarations =?iso-8859-2?B?SmFuIFJpbmdvuQ==?= C++ 10 02-06-2007 06:45 PM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
class Rhash proposal paolo veronelli Python 2 07-15-2004 02:01 PM



Advertisments