CSC/ECE 517 Fall 2010/ch7 7b JB

From Expertiza_Wiki
Revision as of 04:15, 11 December 2010 by Jsberry (talk | contribs)
Jump to navigation Jump to search

Information Expert Pattern

Introduction

Information Expert Pattern is a principle for assigning responsibility in object-oriented design. The fundamental idea is to identify the class with the most information (expertise) and assign responsibility to it.


GRASP

In object-oriented design, the overall problems of assigning responsibility are dealt with by GRASP1, or General Responsibility Assignment Software Patterns (or Principles). GRASP has nine principles, of which Information Expert is one. The others are:

  1. Creator 2
  2. Low Coupling 3
  3. High Cohesion 4
  4. Controller 5
  5. Polymorphysm 6
  6. Pure Fabrication 7
  7. Indirection 8
  8. Protected Variations 9

Process

Using this approach, the programmer would:

  1. Identify a responsibility
  2. Determine what information is needed to fulfill it,
  3. Locate where that information is stored
  4. Identify which class contains the largest subset of the required data
  5. Assign responsibility to that class
  6. Assign the responsible class to recursively apply the Information Expert Pattern for acquiring any data still missing.


References

  1. Wikipedia's GRASP article 10
  2. Information Expert Pattern overview with diagrams 11
  3. Creator and Information Expert Principles with sample code 12