• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Cade's Class Diagram question... Please Help

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,

I started struggling with the part II today and when I looked at the class diagram in the Sun's SCEA book, I noticed two things:

- Address has an unidirectional association to Customer. The navigability arrow is at the customer side, meaning that the responsibility lies on the address object. Shouldn't that be the opposite? Shouldn't a customer have a collection of addresses (home, business,shipping1, shipping 2, etc.) instead of each address having a instance variable to customer? I don't get it.

- Credit card is the same; it also has an unidirectional association to Customer.


Please help!
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Alex,

- Address has an unidirectional association to Customer. The navigability arrow is at the customer side, meaning that the responsibility lies on the address object. Shouldn't that be the opposite? Shouldn't a customer have a collection of addresses (home, business,shipping1, shipping 2, etc.) instead of each address having a instance variable to customer? I don't get it.

- Credit card is the same; it also has an unidirectional association to Customer.


Both your approach and Cade's approach is correct. You can keep customer info in a Address or you can keep Address info in a Customer. Remember you are just looking 2 classes here. When you will have 20+ classes in the class diagram, your design needs to be consistent.

Here is my recommendation - Go ahead and start the design the way you think. As you add more classes to the class diagram, some of the design choices you made earlier may be challanged and you probably will be forced to change the design again.

Good Luck.
 
Alex Silver
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sudhansu,

Thank you for your reply! I feel better now!

Alex

Originally posted by Sudhansu Pati:
Hi Alex,

- Address has an unidirectional association to Customer. The navigability arrow is at the customer side, meaning that the responsibility lies on the address object. Shouldn't that be the opposite? Shouldn't a customer have a collection of addresses (home, business,shipping1, shipping 2, etc.) instead of each address having a instance variable to customer? I don't get it.

- Credit card is the same; it also has an unidirectional association to Customer.


Both your approach and Cade's approach is correct. You can keep customer info in a Address or you can keep Address info in a Customer. Remember you are just looking 2 classes here. When you will have 20+ classes in the class diagram, your design needs to be consistent.

Here is my recommendation - Go ahead and start the design the way you think. As you add more classes to the class diagram, some of the design choices you made earlier may be challanged and you probably will be forced to change the design again.

Good Luck.

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also have a question about Cade's class diagram, there is an unidirectional association from Product to ProductCategories. if that is the case, how can we make product search in the ProductCategories? I also confused with the name ProductCategories and the multiplicity many-to-many, if ProductCategories reprentes a set of structured categories, it seems no need to be many-to-many.
reply
    Bookmark Topic Watch Topic
  • New Topic