---
title: "Pattern vs framework; GRASP patterns"
subject: "Object Oriented Analysis and Design"
chapter: 3
key: "semester_6/object_oriented_analysis_and_design:pattern-vs-framework-grasp"
source: https://www.bctengineer.com/q/semester_6/object_oriented_analysis_and_design/pattern-vs-framework-grasp
site: BCT Engineering
---

# Pattern vs framework; GRASP patterns

Object Oriented Analysis and Design · Chapter 3: Object Oriented Design

- Asked in: 2072 Asoj, 8 marks
- Video: [LECTURE 24 – OOAD –PATTERNS AND FRAMEWORKS - BCA SEM 6](https://www.youtube.com/watch?v=U6AWWO7BIVA) — BOSCOCAMPUSVISION
- Answer checked by Claude Sonnet 5.5 on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/object_oriented_analysis_and_design/pattern-vs-framework-grasp
- Whole chapter: https://www.bctengineer.com/md/semester_6/object_oriented_analysis_and_design/chapter-3

## Question

How pattern different from framework? Explain information Expert, Creator and Low Coupling design patterns defined by GRASP Design Pattern.

## Short answer

A pattern is an abstract solution idea, while a framework is a reusable code skeleton. In GRASP, Information Expert assigns responsibility to the class with the needed data, Creator gives creation to the containing class, and Low Coupling minimizes dependencies to ease change.

## Answer

#### Pattern vs framework

| Point | Pattern | Framework |
|---|---|---|
| Nature | An idea: description of a problem and its solution | Actual code: reusable classes and libraries |
| Level | Abstract, design level | Concrete, implementation level |
| Size | Small, solves one design problem | Large, a whole application skeleton |
| Use | You implement it yourself in any language | You extend or plug into it |
| Control | Your code stays in control | The framework calls your code (inversion of control) |
| Example | Observer, Singleton, Factory | Spring, Struts, Swing |

A framework often **uses** several patterns. Patterns are more general and smaller architectural elements than frameworks.

#### GRASP patterns
GRASP (General Responsibility Assignment Software Patterns, by Larman) guides the assignment of responsibilities to classes.

**1. Information Expert**
- *Problem:* what is the basic principle for assigning a responsibility?
- *Solution:* assign it to the class that has the information needed to fulfil it.
- *Example:* who computes the total of a `Sale`? `Sale` knows its `SalesLineItem`s, so `Sale.getTotal()`; each line item knows its quantity and price, so `SalesLineItem.getSubtotal()`.
- *Benefit:* encapsulation, low coupling, high cohesion.

**2. Creator**
- *Problem:* who should create an instance of class A?
- *Solution:* assign the creation of A to B if B aggregates or contains A, records A, closely uses A, or has the initialising data for A.
- *Example:* `Sale` contains `SalesLineItem`s, so `Sale` creates them (`Sale.makeLineItem()`).
```text
 Sale ---<>--- SalesLineItem
 Sale creates SalesLineItem
```

**3. Low Coupling**
- *Problem:* how to reduce the impact of change and increase reuse?
- *Solution:* assign responsibilities so that coupling (dependency between classes) stays low. Choose the design with fewer dependencies.
- *Example:* if `Register` creates the `Payment` and passes it to `Sale`, then `Register` is coupled to both `Sale` and `Payment`. If `Sale` creates the `Payment` itself, `Register` does not need to know `Payment`, so there is one less dependency and the coupling is lower.
- *Benefit:* classes are independent, and easier to understand, change and reuse.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Which statement distinguishes a pattern from a framework?
   A. A pattern is large code; a framework is an idea
   B. A pattern is an abstract idea; a framework is actual reusable code
   C. Both are identical
   D. A framework is smaller than a pattern
   Answer: B. Patterns describe problem and solution; frameworks are concrete, larger code skeletons that call your code. (Key point: Pattern versus framework)

2. Who computes the total of a Sale according to Information Expert?
   A. Register
   B. Customer
   C. Sale, because it knows its line items
   D. Product
   Answer: C. The class with the information needed (Sale knows its SalesLineItems) gets the responsibility. (Key point: Information Expert)

3. When should B create instances of A under Creator?
   A. B has the initialising data for A or contains, records or closely uses A
   B. B is a subclass of A
   C. B is the user interface
   D. B is unrelated to A
   Answer: A. Creator assigns creation to the class that contains, aggregates, records, closely uses or has data for A. (Key point: Creator)

4. What does Low Coupling advise when choosing between designs?
   A. Choose the one with more links
   B. Choose the one with the fewer dependencies between classes
   C. Choose the one with more classes
   D. Always make all classes public
   Answer: B. Fewer dependencies reduce the impact of change and increase reuse. (Key point: Low Coupling)

## Related in Object Oriented Analysis and Design

- [Framework and design pattern with example](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Aframework-design-pattern-example) — Object Oriented Analysis and Design, chapter 3
- [Pattern based design and benefits](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Apattern-based-design-benefits) — Object Oriented Analysis and Design, chapter 3
- [Short note: Design patterns in deployment](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Ashort-note-design-patterns-deployment) — Object Oriented Analysis and Design, chapter 3
- [Short note: GRASP](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Ashort-note-grasp) — Object Oriented Analysis and Design, chapter 3

## Related in other subjects

- [Knowledge management vs expert systems](https://www.bctengineer.com/question.md?key=semester_8%2Finformation_system%3Akm-vs-expert-systems) — Information System, chapter 4
- [Design patterns and their benefits](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Adesign-patterns) — Software Engineering, chapter 5
- [Typical damage patterns in masonry buildings](https://www.bctengineer.com/question.md?key=semester_5%2Fdesign_of_timber_and_masonry_structures%3Adamage-patterns-masonry-lateral-loads) — Design of Timber and Masonry Structures, chapter 6
- [Reuse framework versus program generator](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Aframework-vs-generator) — Software Engineering, chapter 5
