page_title: Role Class Model
section_title: Cinema
hierarchical_section_title: Role Class Model / Solution / Real-world example / Cinema
caption_attribution_description: English: An example of the Inheritance Role Model applied to the cinema domain.
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 simple application of the role class model in a real example is in the 7th art (see Figure 3), the cinematography. This art involves a creation (the Film) and people to create it. Each person has a different role in the film, they could be actors and play characters, they could be director or scenarist, etc. A person is not limited to one role in a film, they can be both actors and directors and even more. For example, the film Scoop (2006) has been directed by Woody Allen, he is also the scenarist and he plays the role of Sid Waterman.
  In Figure 4, one can see in more detail the role that each person can play in a film. From the film, it is possible to ask the list of crews and cast that help elaborated it. Each person has one or more roles (e.g. actor, director, producer, cameraman, etc.) in the film and can participate in more than one film. A person could even be an actor in a film and a producer in another. One advantage of using a role class in the case of the actor role is that the character qualities can be stored within the role. This is true for the actor role, this is also true for other roles, however maybe not all.
  Only a few of the possible role have been modelled in Figure 4. One remark easily visible is that not all the role needs attributes and using the role class model for all of them is unnecessary (like for the Director role). In addition, there is a lot of redundancy between each role class. Redundancy in computer science means more work in maintenance, which is not wished.
caption: Figure 4: The 7th Art in more details (using UML Class Diagram representation). Click to enlarge.
exif: {}