• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class Diagram..

 
Michael Santosa
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers...
I am just learning UML and I still confuse about
Class Diagram.. maybe it sounds easy for some
experts in this room discussion.. but it's not
for me.
I am confused about associations..
well let's say there are 2 classes, 1st
is Order and 2nd is Customer...
Of course Customer can have many Orders..
Order 0.. * ----- 1 Customer
(is it right ?)
The problem is how to implement associations
into the class relationship in the java codes ?
Does class Customer have order inside
for example like this ?
class Customer
{
List order; // List of order
}
or it's not neccessary that Class customer
must have instance of class order inside ?
and can be implemented by another class
for example Transactions class that use
both Customer and Order ?
Please light me up ... is there any tutorial
about UML by example associated with
Java codes ?
Thanks for the help ...
[ August 26, 2002: Message edited by: Michael Santosa ]
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I'd prefer an array, vector or set of Orders over a list, but you're on the right path.
Transaction could some_customer.getOrders( "amount > $200" );
All clear?
[ August 26, 2002: Message edited by: Rufus Bugleweed ]
 
Redding
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Michael,
I think also that the Order must have a Customer associated with it:
class Order {
Customer cust;
}

Sometimes implimenting UML with code is confusing to me too. For example, if you have an order as defined above, do you realy need to associate the Customers with orders (ie, with a List, Vector, etc...)? I mean, there may be X number of Orders that have associations to one specific Customer. Don't these associations already define the Customer-to-Order relationship? Do we realy need to have the List of Orders in the Customer class? Seems redundant. It seems to me that Order class defined here IS the implemtation of this UML diagram.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic