0% found this document useful (0 votes)
19 views15 pages

Software Design and Architecture

Uploaded by

Zainab Hameed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views15 pages

Software Design and Architecture

Uploaded by

Zainab Hameed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

“SOFTWARE DESIGN AND

ARCHITECTURE “
SOFTWARE DESIGN
PATTERNS
SOFTWARE DESIGN PATTERN

In software engineering, a software design pattern is a general, reusable solution to a


commonly occurring problem within a given context in software design. It is not a finished
design that can be transformed directly into source or machine code. Rather, it is a
description or template for how to solve a problem that can be used in many different
situations. Design patterns are formalized best practices that the programmer can use to
solve common problems when designing an application or system.
GOF

This book was first published in 1994 and it’s one of the most popular books to learn design
patterns. The book was authored by erich gamma, richard helm, ralph johnson, and john
vlissides. It got nicknamed as gangs of Four design patterns because of the four authors.
Furthermore, it got a shorter name “gof design patterns”.
GOF DESIGN PATTERN T
YPES
CREATIONAL
The design patterns that deal with the creation of an object
STRUCTURAL
The design patterns in this category deal with the class structure such as
inheritance and composition
BEHAVIORAL

This type of design pattern provides solutions for better interaction between objects, how to
provide loose coupling, and flexibility to extend easily in the future.
CREATIONAL DESIGN PATTERNS
CREATIONAL DESIGN PATTERNS
Singleton The singleton pattern restricts the initialization of a class to ensure that only one instance of the
class can be created.

Factory The factory pattern takes out the responsibility of instantiating a object from the class to a Factory
class.

Abstract F Allows us to create a Factory for factory classes.


actory

Builder Creating an object step by step and a method to finally get the object instance.

Prototype Creating a new object instance from another similar instance and then modify according to our
requirements
Structural Design Patterns
Name Description

Adapter Provides an interface between two unrelated entities so that they can work together.

Used when we have to implement a part-whole hierarchy. For example, a diagram made of other
Composite
pieces such as circle, square, triangle, etc.

Proxy Provide a surrogate or placeholder for another object to control access to it.
Pattern

Flyweight Caching and reusing object instances, used with immutable objects. For example, string pool.

Facade Creating a wrapper interfaces on top of existing interfaces to help client applications.

The bridge design pattern is used to decouple the interfaces from implementation and hiding the
Bridge
implementation details from the client program.

Decorator The decorator design pattern is used to modify the functionality of an object at runtime.
Behavioral Design Patterns

• There are 11 behavioral design patterns defined in the GoF design patterns
used to create a template method stub and defer some of the steps of implementation to the
Template
Method subclasses.

Mediator used to provide a centralized communication medium between different objects in a system.

used to achieve loose coupling in software design where a request from the client is passed to a chain of
Chain of
Responsi objects to process them.
bility

useful when you are interested in the state of an object and want to get notified whenever there is any
Observer
change.

Strategy pattern is used when we have multiple algorithm for a specific task and client decides the actual
Strategy
implementation to be used at runtime.
Command
Command Pattern is used to implement lose coupling in a request-response model.
State
State design pattern is used when an Object change it’s behavior based on it’s internal state.
Visitor
Visitor pattern is used when we have to perform an operation on a group of similar kind of Objects.
Interpreter
defines a grammatical representation for a language and provides an interpreter to deal with this grammar.
Iterator
used to provide a standard way to traverse through a group of Objects.
Memento
The memento design pattern is used when we want to save the state of an object so that we can restore later on.

You might also like