Association Role Model

Aus THM-Wiki
(Weitergeleitet von Association Role Class Model)
Wechseln zu: Navigation, Suche

The Association Role Solution is one of five role analysis pattern which are described by Francis G. Mossé to offer a solution to any role modelling problem (Role Inheritance, Association Roles, Role Classes, Generalized Role Classes and Association Class Roles). The Association Role Solution is a simple and versatile pattern to handle roles.


Name

Association Role Model


Intent

A model to describe a solution for a base class to play multiple roles.

Problem

The same base class must be able to play different roles in the context of its relation to other classes. The Inheritance Role Model disallows this, so that a solution must be described, the Association Role Solution

Context

A model that allows the same base class to play different roles is required. The role of the base class (in the following example “Company”) is only based on what it does, not what it is.


Figure1.jpg

The base class “Company” can act as a “Customer” as well as a “Vendor”. As a customer, the company buys the product and as a vendor, the company sells the product. “Customer” and “Vendor” are only Association Roles.

Forces

This role analysis pattern has one significant drawback, because it does not allow the use of attributes. If the Association Roles “Vendor” or “Customer” in our example would require the use of attributes, this would not be possible with Association Roles, because only classes are able to hold attributes. Therefore a different method of solution would be required, the use of the Role Classes Solution.

If it becomes necessary to supply the objects with specific attributes, according to Mosse, the use of the Role Classes solution would be an adequate answer.

Solution

The roles are described as an abstraction in a metamodel . In our example the base class is an abstraction of the client.

Example 1


Figure2.jpg

The metamodel is described by

  • the role
  • the direction
  • the quantity
  • the name

Example 2


Example using Association Roles2.jpg


In this example the objects can take multiple roles at the same time.

  • The person can be the owner of a building
  • The person can also be an employee of a company
  • The company can act as an employer
  • The company can also be the tenant of an office

In this second example it is not assumed that the company can also be the owner of a building. The second example demonstrates how a class can interact with multiple other classes while example 1 restricts itself to the demonstration of the relation of one object to one other object.

References / External links

[1] Dealing with Roles [1]

[2] Francis G. Mossé [2]

[3] Role Inheritance The_Inheritance_Role_Model

[4] Role Classes Role_Class_Model

[5] Generalized Role Classes Role_Class_Generalization

[6] Association Class Roles Association_Class_Role_Model