OOPortal OOPortal

Model Refinement   «Prev  Next»
Lesson 6 Who should own the operations?
Objective Define guidelines for allocating responsibility for attributes.

Who should own the Operations?

The operations in a class description define two types of behavior:
  1. what an object can do and
  2. what can be done to the object.
For example, a book can contain pages, chapters, and a table of contents. A book can be read, printed, and sold.

Operation notation

The UML operation notation defines the elements of a class behavior modeled using the syntax:
[visibility] name ([parameter-list]) ':' [return-result] [{properties}]

In addition, UML supports the use of exceptions, pre-conditions, and post-conditions. I will cover the notation elements first, and then these additional operation elements.

Finding behaviors of an object

The sequence (interaction) diagrams provide a method for finding the behaviors of an object that are needed by the current problem domain. These behaviors are defined as interfaces of the object because other objects need to request them. The sequence diagram approach will provide you with the minimum requirements for navigation between objects.
Other behaviors are internal to an object. Operations may perform any of the following purposes:

  1. Support the implementation of the interfaces
  2. Manage the state of the object
  3. Maintain the attribute values that describe the object
  4. Allow the object to maintain relationships with other objects

The key to assigning behaviors to an object

Again, the key to assigning behaviors to an object is responsibility.
  1. What is the responsibility of the object?
  2. Are the behaviors required to fulfill the object's responsibility?