CSC/ECE 517 Fall 2010/ch7 7b JB: Difference between revisions
No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
==GRASP== | ==GRASP== | ||
In object-oriented design, the overall problems of assigning responsibility are dealt with by | In object-oriented design, the overall problems of assigning responsibility are dealt with by [http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29 GRASP 1], or General Responsibility Assignment Software Patterns (or Principles). GRASP has nine principles: | ||
#Creator | # Information Expert | ||
#Low Coupling | # Creator | ||
#High Cohesion | # Low Coupling | ||
#Controller | # High Cohesion | ||
#Polymorphysm | # Controller | ||
#Pure Fabrication | # Polymorphysm | ||
#Indirection | # Pure Fabrication | ||
#Protected Variations | # Indirection | ||
# Protected Variations | |||
There are often situations in programming object-oriented designs when data needed by an object is spread out across several other objects. Rather than access each object individually and sequentially to get the details one at a time, the Information Expert pattern can be used to keep the program organized and straightforward. This will help to enable later extension of the program to enable new functionality without adding a lot of complexity. | |||
==Process== | ==Process== | ||
Line 26: | Line 29: | ||
# Assign responsibility to that class | # Assign responsibility to that class | ||
# Assign the responsible class to recursively apply the Information Expert Pattern for acquiring any data still missing. | # Assign the responsible class to recursively apply the Information Expert Pattern for acquiring any data still missing. | ||
==References== | ==References== | ||
# [http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29 Wikipedia's GRASP article | # [http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29 Wikipedia's GRASP article 1] | ||
# [http://cs.armstrong.edu/hsu/Course/CSCI3321/PracticalSoftwareEngineering/html/ch10s04.html Information Expert Pattern overview with diagrams | # [http://cs.armstrong.edu/hsu/Course/CSCI3321/PracticalSoftwareEngineering/html/ch10s04.html Information Expert Pattern overview with diagrams 2] | ||
# [http://programmersnotes.info/2009/03/28/creator-and-information-expert-grasp-design-pattern-series/#expert Creator and Information Expert Principles with sample code | # [http://programmersnotes.info/2009/03/28/creator-and-information-expert-grasp-design-pattern-series/#expert Creator and Information Expert Principles with sample code 3] |
Revision as of 04:29, 11 December 2010
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 GRASP 1, or General Responsibility Assignment Software Patterns (or Principles). GRASP has nine principles:
- Information Expert
- Creator
- Low Coupling
- High Cohesion
- Controller
- Polymorphysm
- Pure Fabrication
- Indirection
- Protected Variations
There are often situations in programming object-oriented designs when data needed by an object is spread out across several other objects. Rather than access each object individually and sequentially to get the details one at a time, the Information Expert pattern can be used to keep the program organized and straightforward. This will help to enable later extension of the program to enable new functionality without adding a lot of complexity.
Process
Using this approach, the programmer would:
- Identify a responsibility
- Determine what information is needed to fulfill it,
- Locate where that information is stored
- Identify which class contains the largest subset of the required data
- Assign responsibility to that class
- Assign the responsible class to recursively apply the Information Expert Pattern for acquiring any data still missing.