Skip to content

Instantly share code, notes, and snippets.

@lunohodov
Created June 16, 2018 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lunohodov/e0dce43e462ac9cf61db68f8b1890675 to your computer and use it in GitHub Desktop.
Save lunohodov/e0dce43e462ac9cf61db68f8b1890675 to your computer and use it in GitHub Desktop.
Object Role Stereotypes

Object Role Stereotypes are a set of general, pre-established roles which commonly occur across object-oriented architectures. By establishing a set of role stereotypes, developers can provide themselves with a set of templates which they can use as they go through the mental exercise of decomposing behavior into cohesive components.

The concept of Object Role Stereotypes is discussed in the book Object Design: Roles, Responsibilies, and Collaborations by Rebecca Wirfs-Brock and Alan McKean.

The book presents the following stereotypes:

  • Information holder – an object designed to know certain information and provide that information to other objects.
  • Structurer – an object that maintains relationships between objects and information about those relationships.
  • Service provider – an object that performs specific work and offers services to others on demand.
  • Controller – an object designed to make decisions and control a complex task.
  • Coordinator – an object that doesn’t make many decisions but, in a rote or mechanical way, delegates work to other objects.
  • Interfacer – an object that transforms information or requests between distinct parts of a system.

While not prescriptive, this set of role stereotypes provides an excellent mental framework for aiding in the software design process. Once you have an established set of role stereotypes to work within, you’ll find it easier to group behaviors into cohesive groups of responsibilities related to the object’s intended role.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment