GRASP - PowerPoint PPT Presentation

About This Presentation
Title:

GRASP

Description:

Referring to the 9 heuristics as patterns is a ... The Lectures page links to the java files below These classes ... Yes: for ( Iterator i = c.iterator ... – PowerPoint PPT presentation

Number of Views:138
Avg rating:3.0/5.0
Slides: 9
Provided by: PeterC206
Category:

less

Transcript and Presenter's Notes

Title: GRASP


1
GRASP
2
GRASP
  • GRASP an acronym that stands for
  • General
  • Responsibility
  • Assignment
  • Software
  • Patterns
  • I think a RAP is a better acronym.
  • Do the words general software pull their
    weight?
  • Referring to the 9 heuristics as patterns is a
    stretch.

3
The 9 GRASP
  • Information Expert
  • Information expert the class that has the
    information necessary to fulfill the
    responsibility.
  • Assign a responsibility to the information
    expert.
  • Creator
  • Who creates instances of class A?
  • Class B when
  • B has As
  • B is an information expert for A (has the
    constructor arguments).

4
The 9 GRASP
  • Controller
  • Who handles a system event?
  • The systems façade controller class.
  • Low coupling
  • Minimize inter-class coupling
  • High cohesion
  • Maximize intra-class cohesion

5
The 9 GRASP Polymorphism
  • To vary a general behavior by class, extend a
    base class.
  • Example Command pattern.
  • The Lectures page links to the java files below
  • These classes illustrate bad as well as good
    style.
  • Cell.java CellImpl.java
  • ActionItem.java
  • ExpressItem.java
  • APTSpawn.java

6
The 9 GRASP Pure Fabrication
  • Assign a highly cohesive set of responsibilities
    to a class that is
  • Not in the application domain
  • Created to support OOD
  • High cohesion
  • Low coupling
  • Examples
  • Façade, adaptor, bridge patterns are pure
    fabrications that lower coupling.
  • PersistentStorage class (books example).

7
The 9 GRASP Indirection
  • Mediate
  • Acting through an intervening agent.
  • To interpose between parties, esp. for the
    purpose of effecting an agreement as, to mediate
    between nations.
  • A client/service mediator class.
  • Lowers coupling
  • Examples Façade, Adaptor, Bridge
  • (Sound familiar? ? )

8
The 9 GRASP Protected Variations
  • Define a stable interface to hide an area of
    instability.
  • Yes
  • List list new ArrayList() // java.util.List
    not java.awt.List
  • No
  • ArrayList list new ArrayList()
  • Yes
  • for ( Iterator i c.iterator() i.hasNext() )
  • doSomething( i.next() )
  • Yes
  • Java List, Map interfaces.
  • Yes
  • Create protected variations only around an area
    of instability.
Write a Comment
User Comments (0)
About PowerShow.com