24 Questions
What is the primary goal of GRASP patterns?
To provide a methodical approach to learning basic object design
What is the definition of a responsibility in the context of UML?
A contract or obligation of a classifier
What is the name of the person who created the GRASP acronym?
Craig Larman
What is the main focus of the GRASP patterns?
Creating responsibilities for classes
What is the quote about the most likely way for the world to be destroyed referring to?
The role of computer professionals in causing accidents
How many GRASP patterns are presented and discussed in the text?
Four
What is the significance of GRASP patterns in relation to object design?
They are a methodical approach to learning basic object design
What is the primary objective of using GRASP patterns?
To understand and apply design principles
What is the primary goal of the Low Coupling pattern?
To minimize dependencies between classes
Which GRASP pattern is responsible for assigning responsibilities to classes based on the information they possess?
Information Expert
What is the purpose of the Controller pattern?
To handle system events or coordinate activities
Which class should be responsible for calculating interest on a bank account, according to the Information Expert pattern?
BankAccount class
What is the primary purpose of the Observer pattern in the context of GRASP patterns?
To notify interested parties of changes in bank account balances
According to the Creator pattern, which class(es) should be responsible for creating instances of a new bank account?
Bank class or AccountManager class
What is the primary goal of the High Cohesion principle?
To promote high cohesion and minimize coupling
Which GRASP pattern is responsible for assigning responsibilities to classes based on their ability to handle system events or coordinate activities?
Controller
What is the primary focus of the 'doing' responsibilities of an object?
Initiating action in other objects
According to the GRASP pattern 'Information Expert', what is the primary consideration for assigning a responsibility to a class?
The class's possession of the information needed to fulfill the responsibility
What type of pattern is the GRASP pattern 'Creator' an example of?
Creational pattern
What is the primary difference between 'knowing' and 'doing' responsibilities?
Knowing is about private data, while doing is about initiating actions
What is the purpose of a GRASP pattern?
To describe a problem and solution pair that can be applied in new contexts
How many GRASP patterns are mentioned in the text?
9
What is the primary principle of the GRASP pattern 'Controller'?
Assign a responsibility to the class that controls and coordinates activities
What is the primary characteristic of a 'knowing' responsibility?
It involves knowing about private encapsulated data
Study Notes
GRASP Patterns
- GRASP (General Responsibility Assignment Software Patterns) is an acronym created by Craig Larman to encompass nine object-oriented design principles related to creating responsibilities for classes.
- GRASP patterns are a learning aid to help talk about and methodically do fundamental object design.
- The assignment of responsibilities and design of collaborations are very important and creative steps during design.
Responsibilities
- A responsibility is a contract or obligation of a classifier.
- There are two types of responsibilities:
- Doing: includes doing something itself, initiating action in other objects, controlling and coordinating activities in other objects.
- Knowing: includes knowing about private encapsulated data, knowing about related objects, knowing about things it can derive or calculate.
GRASP Patterns (Examples)
- Information Expert: Assign a responsibility to the class that has the information needed to fulfill it.
- Creator: Assign the responsibility of creating instances of a class to the class that has the most knowledge about when and how to create them.
- Low Coupling: Aims for classes to have minimal dependencies on each other, facilitating easier maintenance and flexibility in the system.
- Controller: Assign the responsibility of handling system events or coordinating activities to a controller class.
Other GRASP Patterns
- High Cohesion: Promotes high cohesion within a class.
- Polymorphism: Supports variation in behavior.
- Pure Fabrication: Creates a new class that does not represent a real-world concept.
- Indirection: Provides an intermediate object to reduce coupling between classes.
- Protected Variations: Anticipates and protects against variations in the system.
Learn about GRASP patterns and their application in software construction, including four key patterns. Understand the importance of responsible software development.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free