Search code examples
umlassociationsdata-access-layeraggregationclass-diagram

Which relationship should I choose: association or aggregation?


I have a Proffesor table in a database. I would like to create an UML diagram for the code-behind part.

The class structure would be: - a Proffesor class that maps the information from the database table (id, first name, etc) - a ProffesorDAL class which connects to the DB and queries it in order to add,remove,update Proffesor instances - 3 forms which add/delete/update proffesors, by accesing the ProffesorDAL class

I thought that the forms-ProffesorDAL relationship is a composition relationship. Is this correct? How about the ProffesorDAL-Proffesor relationship, could it be aggregation or is it just association? What's the best UML relationship for the forms-Proffesor relationship?

Thanks!


Solution

  • I'd start by assuming association and from there to analyse and design if there should be a stronger relation between the two.

    My question goes "Does it own it". Example I'd say a Car owns 4 wheels (among a long list of other items).

    In my standard design I have a BLL between my UI and DAL. I start by assuming a loose association between my three, later I reach the conclusion that the BLL and DAL are somewhat closely connected and could benefit from a strong tie.

    As for the Professor class, I assume this to be a Model class. Model classes I only have a loose connection / knowledge to - meaning they appears only as parameters (association). My DALs do not have a strong connection with my Model classes (aggregation). They are but Message bringers, complex ints and bools.