SlideShare a Scribd company logo
Neversettle
intive.com
_GRASP
Karol Kreft
PHPers Summit 2019
06.09.2019, Poznań
Neversettle
intive.com
2
Neversettle
intive.com
3
Neversettle
intive.com
4
Neversettle
intive.com
• www.craiglarman.com
• UML, OOP, Analysis & Design
• GRASP
• Agile and LeSS
5
Craig Larman
Neversettle
intive.com
6
The GRASP name was
chosen to suggest the
importance of grasping
these principles to
successfully design
object-oriented software.
Neversettle
intive.com
7
General
Responsibility
Assignment
Software
Patterns
Neversettle
intive.com
8
Responsibilities
Neversettle
intive.com
• do something
• know something{
Responsibilities
Neversettle
intive.com
10
Neversettle
intive.com
11
Neversettle
intive.com
GRASP
1. Information Expert
2. Creator
3. Controller
4. Low coupling
5. High cohesion
6. Indirection
7. Polymorphism
8. Pure Fabrication
9. Protected Variations
Neversettle
intive.com
Information Expert
_Assign a responsibility to the information expert
– the class that has the information necessary to
fulfill the responsibility.
Neversettle
intive.com
Information Expert
_Place responsibilities with data
_That which knows, does
_Do it Myself
_Put Services with the Attributes They Work On
Neversettle
intive.com
15
Neversettle
intive.com
16
Neversettle
intive.com
Creator
_Who should be responsible for creating a new
instance of some class?
_Choose class B when
_B aggregates A objects
_B contains A objects
_B closely uses A objects
_B as the initializing data that are required to creatingA
Neversettle
intive.com
18
Neversettle
intive.com
Neversettle
intive.com
Controller
_Who should be responsible for handling
system event?
Neversettle
intive.com
21
Neversettle
intive.com
Bloated Controller
_Controllers which handle too many system
events leading to low cohesion. This can be
avoided by addition of a few more controllers.
_Always remember about delegating
responsibilities to other objects.
_Use Command Pattern in a message-handling
systems.
Neversettle
intive.com
Low coupling
High cohesion
Neversettle
intive.com
Low Coupling
_How to support low dependency
and increased reuse?
High Cohesion
_How to keep complexity manageable?
Neversettle
intive.com
Low Coupling
_Assign responsibilities so that coupling
remains low.
High Cohesion
_Assign responsibilities so that cohesion
remains high.
Neversettle
intive.com
High Coupling
_Changes in related classes force local changes
_Harder to understand in isolation
_Harder to reuse because its use requires the
additional presence of the classes it
dependent upon
_Coupling may not be important if reuse
is not a goal.
Neversettle
intive.com
Low Cohesion
_Hard to comprehend
_Hard to reuse
_Hard to maintain
_Delicate; constantly effected by change
Neversettle
intive.com
_Low Coupling and High Cohesion are principles
to keep in mind during all design decisions.
_They are evaluative patterns which a designer
applies while evaluating all design decisions.
Neversettle
intive.com
29
Neversettle
intive.com
30
_Where to assign a responsibility to avoid
direct coupling between two or more
things?
Neversettle
intive.com
31
_Where to assign a responsibility to avoid
direct coupling between two or more
things?
_Assign the responsibility to an
intermediate object to mediate
between other components or
services to avoid direct coupling.
Neversettle
intive.com
32
Neversettle
intive.com
GRASP
1. Information Expert
2. Creator
3. Controller
4. Low coupling
5. High cohesion
6. Indirection
7. Polymorphism
8. Pure Fabrication
9. Protected Variations
Neversettle
intive.com
34
Do we need
object oriented design?
Neversettle
intive.com
35
Neversettle
intive.com
36
http://bit.ly/grasp-talk
@karol_kreft
Neversettle
intive.com
37
• Photo by La-Rel Easter on Unsplash
• Photo by Feliphe Schiarolli on Unsplash
• Photo by Andrej Lišakov on Unsplash
• Photo by Rohit Choudhari on Unsplash
• Photo by Javier Allegue Barros on Unsplash
Photos

More Related Content

PPTX
How to Rescue Complex Projects from Disaster
PPTX
Management and leadership
PPTX
Software design principles
PDF
5. ch 4-principles that guide practice
PPT
Lecture note 3 on software engineering and development
PPTX
Pressman_Pressman_SoftwareEngineeringPA_9e_Ch006_PPT.pptx
PPT
lec9-ch7.ppt
PDF
Design Patterns Explained: From Analysis through Implementation
How to Rescue Complex Projects from Disaster
Management and leadership
Software design principles
5. ch 4-principles that guide practice
Lecture note 3 on software engineering and development
Pressman_Pressman_SoftwareEngineeringPA_9e_Ch006_PPT.pptx
lec9-ch7.ppt
Design Patterns Explained: From Analysis through Implementation

Similar to GRASP - one more way to reach clean code (20)

PDF
Availability in a cloud native world v1.6 (Feb 2019)
PPTX
Software development philosophies v1
PPTX
Digests for the book "Scalability Rules: 50 Principles for Scaling Web Sites"
PPTX
Software design principles for evolving architectures
PPTX
Intro to Cloud Native _ v1.0en (2021/01)
PDF
Approaches for Distributed Agile
PDF
Structured Software Design
PDF
Maintaining Large Scale Julia Ecosystems
PPTX
Architecting Solutions and Systems – Randy’s Secrets to Success
PPTX
DOIS22 Why you need Cloud-agnostic practices to fuel your DevSecOps adoption ...
PPTX
2022 DOI SKILup Days_Your Developers Decide Your Security Posture_Not Your Se...
PDF
Agile_Project_Management_Methods_for_ERP.pdf
PPTX
GRASP Principles
PPTX
unit-1 agile development.pptx
PDF
Mainframes agile2012
PPT
Agile Software Development in Bachelor of Computer Applications.ppt
PPTX
Clean code: SOLID (iOS)
PPTX
Clean code: SOLID
PDF
Site-Reliability-Engineering-v2[6241].pdf
PPTX
Building Large Sustainable Apps
Availability in a cloud native world v1.6 (Feb 2019)
Software development philosophies v1
Digests for the book "Scalability Rules: 50 Principles for Scaling Web Sites"
Software design principles for evolving architectures
Intro to Cloud Native _ v1.0en (2021/01)
Approaches for Distributed Agile
Structured Software Design
Maintaining Large Scale Julia Ecosystems
Architecting Solutions and Systems – Randy’s Secrets to Success
DOIS22 Why you need Cloud-agnostic practices to fuel your DevSecOps adoption ...
2022 DOI SKILup Days_Your Developers Decide Your Security Posture_Not Your Se...
Agile_Project_Management_Methods_for_ERP.pdf
GRASP Principles
unit-1 agile development.pptx
Mainframes agile2012
Agile Software Development in Bachelor of Computer Applications.ppt
Clean code: SOLID (iOS)
Clean code: SOLID
Site-Reliability-Engineering-v2[6241].pdf
Building Large Sustainable Apps
Ad

Recently uploaded (20)

PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Sustainable Sites - Green Building Construction
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPT
Total quality management ppt for engineering students
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPT
Project quality management in manufacturing
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPT
Mechanical Engineering MATERIALS Selection
PDF
PPT on Performance Review to get promotions
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Sustainable Sites - Green Building Construction
Automation-in-Manufacturing-Chapter-Introduction.pdf
Foundation to blockchain - A guide to Blockchain Tech
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
Categorization of Factors Affecting Classification Algorithms Selection
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Total quality management ppt for engineering students
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
Project quality management in manufacturing
CYBER-CRIMES AND SECURITY A guide to understanding
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
Mechanical Engineering MATERIALS Selection
PPT on Performance Review to get promotions
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Ad

GRASP - one more way to reach clean code