class structure proposal

Discussion in 'Java' started by Grzegorz Stasica, Jul 8, 2003.

  1. 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;
    }
    Grzegorz Stasica, Jul 8, 2003
    #1
    1. Advertising

  2. Grzegorz Stasica

    rkm Guest

    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;
    > }
    >
    rkm, Jul 8, 2003
    #2
    1. Advertising

  3. Grzegorz Stasica

    Dale King Guest

    "Grzegorz Stasica" <> wrote in message
    news:bednb2$hps$...
    > 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
    Dale King, Jul 8, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. E11
    Replies:
    1
    Views:
    4,710
    Thomas Weidenfeller
    Oct 12, 2005
  2. paolo veronelli

    class Rhash proposal

    paolo veronelli, Jul 14, 2004, in forum: Python
    Replies:
    2
    Views:
    292
    paolo veronelli
    Jul 15, 2004
  3. =?iso-8859-2?B?SmFuIFJpbmdvuQ==?=

    Proposal for signed/unsigned modifier in class declarations

    =?iso-8859-2?B?SmFuIFJpbmdvuQ==?=, Feb 3, 2007, in forum: C++
    Replies:
    10
    Views:
    563
    =?iso-8859-2?B?SmFuIFJpbmdvuQ==?=
    Feb 6, 2007
  4. jmucchiello
    Replies:
    9
    Views:
    413
    Alan Woodland
    Aug 26, 2009
  5. Johannes Schaub (litb)
    Replies:
    3
    Views:
    326
    Victor Bazarov
    Sep 10, 2010
Loading...

Share This Page