0

I want to correctly represent my POCO classes of Entity Framework in UML diagram. For instance, I have the following relationships :

public class SchoolGroup {
     public int Id {get;set;}
     public string GroupName {get;set;}
     public Subject GroupSubject {get;set;}
     public Teacher GroupTeacher {get;set;}
     public ICollection<Student> AttendeeStudents {get;set;}
}

Here we see that School Group Entity contains of instances of Subject, Teacher and a collection of Students.

According to this post Difference between association, aggregation and composition :

Association - I have a relationship with an object. Foo uses Bar.

Composition - I own an object and I am responsible for its lifetime, when Foo dies, so does Bar.

Aggregation - I have an object which I've borrowed from someone else. When Foo dies, Bar may live on.

So, how should I represent my SchoolGroup in UML notation : will it be a composition or an aggregation?

Community
  • 1
  • 1
Iskander Raimbaev
  • 1,322
  • 2
  • 17
  • 35
  • You have to think about it in terms of the real world. Assuming you can think of a SchoolGroup as a school, if that school closes down, will the teachers have jobs left, and will there be any subjects or students attending it anymore? From what I can understand, you want to use composition. – Keyur PATEL Sep 13 '16 at 04:02
  • I would just not use it. Comp/Aggr is meaningful in DB design to set constraints and for memory management (which today is becoming a don't-care). The semantics of those is near to nil else. – qwerty_so Sep 13 '16 at 08:54

0 Answers0