Software patterns - GRASP (Part I - Introduction)

Posted by in Best Practices category on for Advance level | Points: 250 | Views : 25200 red flag
Rating: 4.6 out of 5  
 5 vote(s)

In OOAD, assignment of responsibilties to classes and objects is an inportant task and GRASP caters the guidelines for such assignments.


To understand what patterns are and what is GRASP.

Introduction and background

The verb “Software Pattern” is present for couple of decades and it came into limelight with GOF (Gang of Four) publishing their book “Design Patterns: Elements of Reusable Object-Oriented Softwarein 1994. This book put forth the catalog of well described design patterns for object oriented software programs. C++ and JAVA world has been aware of such patterns for long time.

Patterns are inviting considerable attention in recent years through workshops, seminars, forums, papers in journals and worth to mention the books.

With .NET catching the eye and also attaining stability, the patterns are becoming the regular term in their world. .NET framework itself is developed with pattern orientation and there are so many good examples in the framework itself.

So what’s so special and exiting about patterns? Patterns can be termed as comprising the efforts to build on collective experience of skilled designers and software engineers. These experts have found solutions to many recurring software design problems and such solutions are captured in patterns which are understandable, well written and practical forms.

Patterns do not usually contain new ideas but highlight or codify existing knowledge and basic principles.


What is Pattern?

It is common that when experts works on particular problems, they need not reinvent the wheel i.e. they need not find a complete new solution that is completely different from existing solutions. Rather they remember the similar problem and it solution and reuse the core of it for solving new problem. They think in terms of “Problem Solution” pairs. Abstracting from such pairs and churning out the commonalities leads to patterns.

Each pattern is three-part rule which expresses a relation between a certain context, a problem and a solution.

Patterns have names and they facilitate communication- common vocabulary and understanding-easy to remember whole concept in a nutshell.


Craig Larman coined these terms for the first time.

stands for General Responsibility Assignment Software Patterns.

The mnemonic meaning could be “successful OOAD (Object Oriented Analysis & Design) requires grasping (understanding)”.

General: = Abstract i.e. widely applicable for variety of situations

Responsibility: = Obligations, duties –information object performing duty of holding information, computational object performing duty of computation

Assignment: = Giving a responsibility to a module- capability to carry out responsibility structure and methods

Software: = Computer code

Patterns: = Regularities, templates, abstraction

Assigning responsibilities to objects is always is major task in designing the software’s. Specifically it’s always a challenge to decide which object carry out what job (responsibilities) and quality of software design largely depended upon such responsibilities assignment.

Poor choices about such responsibities leads to fragile systems and components which are hard to maintain, understand, reuse or extend.

Let’s define responsibility:

Responsibility is defined as a contract or obligation of a type or class and is related to behavior.

There are 2 types of responsibilities

1.       Knowing - responsibilities of an object include

a.       Knowing about private encapsulated data-member data

b.      Knowing about related objects

c.       Knowing about things it can derive or calculate

2.       Doing - responsibility of an object include

a.       Doing something itself-assign, calculate, create

b.      Initiating action in other objects

c.       Controlling and coordinating activities in other objects

The responsibilities would be translated into classes and their methods and it is largely influenced by the granularity of the responsibility. Don’t confuse the responsibility as a method in a class even though they are implemented using methods which either act alone or collaborate with other methods and objects. Object-oriented principles are applied by experienced developers/experts in deciding general assignment of responsibilities.

GRASP patterns describe fundamental principles of assigning responsibilities to objects and it has following principles and patterns in the family

  • Information Expert
  • Creator
  • Controller
  • Low Coupling
  • High Cohesion
  • Polymorphism
  • Pure Fabrication
  • Indirection
  • Protected Variations.


We discussed the software patterns, the GOF and started on GRASP. These concepts are bit difficult to understand as these are not part of day to day vocabulary of developer community. To build better and robust software systems which are easy to maintain, reuse, the programmer needs to be aware of such concepts, principles which help him to solve the problems to the core. Especially large or enterprise systems can’t last long if they are built without giving attentions to patterns and patter oriented development.

Let’s delve into specific patterns in the next part of this article.

Happy Programming!!!!!


Applying UML and Patterns
Craig Larman

Page copy protected against web site content infringement by Copyscape

About the Author

Full Name: Vishwas Sutar
Member Level: HonoraryPlatinum
Member Status: Member,MVP
Member Since: 5/30/2011 2:13:10 AM
Country: India
Extensive and rich experience across gamut of technologies and programming languages like PB,VB,C++,VB.NET, C#, Classic ASP,ASP.NET, ASP.NET MVC.

Login to vote for this post.

Comments or Responses

Posted by: Ashuthinks on: 8/8/2011 | Points: 25
This is something new to me
very good article :)
Posted by: Vuyiswamb on: 9/1/2011 | Points: 25
This is an Excellent Article.

Thanks for sharing.

Posted by: Ugain on: 10/6/2011 | Points: 25
I wish I had read these articles when I was 6 months old in the industry and wrote my 1st class in Visual Basic years ago, excellent stuff !

Posted by: Sheonarayan on: 10/23/2013 | Points: 25
Nice article.

Login to post response

Comment using Facebook(Author doesn't get notification)