We'll discuss the concept of the Design Pattern in this session. A basic go through of:
* What are Design Patterns?
* Why we should know Design Patterns?
* How to use Design Patterns?
With a Demonstration of some of its types.
2. The Agenda
● What, What not?
● Why?
● How?
○ Classification and when to use what?
○ Demo
3. What, What not?
The principle states that we should always prefer
Composition over Inheritance, and code for
interface not for Implementation.
Design Patterns:
● Are reusable solutions to the commonly
occurring problem within a given context in
software design.
● Aren’t finished design that can be transformed
directly into code
4. Why?
● Design patterns can speed up the
development process by providing
tested, proven development paradigms.
● Helps to prevent invisible issues prior
to development.
● Improves code readability.
6. How?
Classification: Creational
When we want to create an object then we should use Creational Design
Patterns.
➔ Singleton
➔ Factory
➔ Abstract Factory
➔ Builder
➔ Prototype
7. How?
Creational: Factory Pattern
A Pattern which manufactures Objects for you on demand without making
changes to your client application, keeping real objects abstracted.
9. How?
Creational: Prototype Pattern
➔ Involves creating objects by cloning them from existing ones. Its purpose is
related to performance and keeping it high by trying to avoid expensive calls.
10. How?
Classification: Structural
When we want to Compose Objects then we should use Structural Design Patterns.
➔ Adapter
➔ Composite
➔ Proxy
➔ Fly Weight
➔ Facade
➔ Bridge
➔ Decorator
11. How?
Structural: Adapter Pattern
➔ Involves creating objects which are compatible with target system by
implementing the incompatible client and using the target system instance in
an Adapter Class.
13. How?
Classification: Behavioral
When we want objects to communicate without composing them then we should Behavioral Design
Patterns.
➔ Template Method
➔ Mediator
➔ Chain
➔ Chain of Responsibility
➔ Observer
➔ Strategy
➔ Command
➔ State
➔ Visitor
➔ Iterator
➔ Interpreter
➔ Memento