Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Class design

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Class design

    Hi all

    i have a doubt in designing classes.
    currently i am dealing with an school management program.

    two of my main classes are Student, and Teacher, each contains attributes for each entity.

    my doubt is how i implement many-to-many relation in class?
    that is each student may have multiple number of teachers associate with.
    similarly each teacher have to assign may students.

    i am familiar in dealing this scenario in SOL using a third table.
    But how i model class to handle this in class itself....

    thanks in advance.....


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Class design

    Keep it simple, Sally: can't each Teacher contain a List of Students, and can't each Student contain a List of Teachers?

  3. #3
    Junior Member
    Join Date
    Nov 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Class design

    thanks kevin

    its the first idea that i got.

    but need to know is that the best one...?
    im not a professional programmer and know what is the best way to achieve this.....

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Class design

    There is no "best one". Try it out. Does it work? Does it give you any problems?

    Define "best one", and we can try to go from there, but as a general rule: simpler is better.

  5. #5
    Junior Member
    Join Date
    Nov 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Class design

    ok kevin it works for my need
    thanks for your suggestion

Similar Threads

  1. star design programs
    By prasansani in forum Java Theory & Questions
    Replies: 6
    Last Post: September 20th, 2011, 12:42 PM
  2. HELP! Design Review & Risk Management topics (in java projects)required
    By gangestech in forum Java Theory & Questions
    Replies: 0
    Last Post: September 6th, 2010, 04:11 AM
  3. Replies: 2
    Last Post: April 12th, 2010, 11:13 AM
  4. How do you design a complex program
    By mydarkpassenger in forum Java Theory & Questions
    Replies: 5
    Last Post: March 19th, 2010, 06:52 PM
  5. Design question about maps
    By KaleeyJ in forum Java Theory & Questions
    Replies: 1
    Last Post: February 2nd, 2010, 04:17 AM