page_title: Role Class Model
section_title: Solution
hierarchical_section_title: Role Class Model / Solution
caption_attribution_description: English: Role Class Meta-model according to Francis G. Mossé.
context_page_description: In computer science, the role class model is a role analysis pattern described by Francis G. Mossé in his article on Modelling Roles. The role class pattern provides the ability for a class to play multiple roles and to embed the role characteristic in a dedicated class.
  In our society, as we built it, roles are everywhere. Anyone trying to work in a team to create something has a role. In cinematography, many different persons take part in the creation of a film: the film director, the producer, actors, play writer, etc.
  Even our State organisations are based on various roles. In a Republic, you have a President, Ministers, Deputies, etc.
  Dealing with these situations is one of the problems encountered most during object-oriented analysis. Francis G. Mossé has identified 5 role analysis patterns that can be used to solve most role related problems: Role Inheritance, Association Roles, Role Classes, Generalised Role Classes and Association Class Roles. They all have various degrees of constraints, flexibility or power, which together offer a complete solution to most role-related problems.
context_section_description: A solution to the previous problem could be to use the Association Role Model, which could create an association between a person and a film. However, specific information on each role could not be stored in such a case. The role class model provides the flexibility of the association with role-specific attributes and even class operations, if needed.
  This meta model - in Figure 2 - shows the role class like an element linking the Client and the BaseClass. For the Client interacting with the Role is like interacting with the Base Class itself, but from the perspective, it is expecting. The advantage having the role as a class is that attributes can be bound to it.
  Another situation where the Role pattern is interesting is when you've the following situation:
  Then you realise that as a contract holder, the Person has specific attributes. The holder UML role becomes a dedicated class ContractHolder with these specific attributes. Note that in that case that the multiplicity near Person and Contract are always 1. It means that you've one ContractHolder object for each association between a Contract and a Person.
caption: Figure 2: Role class meta model (using UML meta model representation)
exif: {}