File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes OO, Patterns, UML and Refactoring and the fly likes what will be the realtion association/aggregation ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "what will be the realtion association/aggregation ?" Watch "what will be the realtion association/aggregation ?" New topic
Author

what will be the realtion association/aggregation ?

l al
Greenhorn

Joined: Jun 21, 2006
Posts: 1
I have a EMP table in database. My application has Emp.java mapping to this table.
There is EmpSingleton.java which is a singleton class in the system, which has a vector which will load all the Emp records. So when a employee information is required first we get a reference to the singleton and then get the details of the particular record
In the constructor of the EmpSingleton, the vector is created but the records are not loaded. The client invokes a seperate function to load the records of Emp.
Now in UML if I show the objects EmpSingleton and Emp what will be the kind of relation between these two. Will it be assocation/aggregation/composition?

[ June 21, 2006: Message edited by: l al ]
[ June 21, 2006: Message edited by: l al ]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Hi, welcome to the ranch!

I wouldn't call it composition becasue the singleton doesn't seem to be made up of Employees. It holds a collection of them but that doesn't quite feel the same.

By the way: This may be fine as a learning exercise, but I'd consider alternatives to this design idea for a system of any size or complexity. What if you get too many Employees to fit into memory at the same time? How long will it take to load them? How will you handle updates back to the database or file ... could some class change an Employee object and never tell the singleton? What if two or more copies of this program need to update the employee database at the same time? How do you create new Employees?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what will be the realtion association/aggregation ?