Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what will be the realtion association/aggregation ?

 
l al
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic