Design Pattern Slide 01bbbbbbbbbbbbbbbbbbbbbbb.pptx

nrezaeeof 0 views 43 slides Oct 12, 2025
Slide 1
Slide 1 of 43
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43

About This Presentation

about design pattern


Slide Content

Design Pattern Introduction to Design Pattern and an Overview Computer Science Faculty Network Engineering Department Slide:- 01 Year:- 2023

Contents Design Pattern What is Gang of Four (GOF)? What does the pattern consist of? Why should we learn patterns? Need of Design pattern Usage of Design Pattern Benefits of Design pattern Classification of patterns

Design Pattern Design patterns represent the best practices used by experienced object-oriented software developers. Design patterns are solutions to general problems that software developers faced during software development. These solutions were obtained by trial and error by numerous software developers over quite a substantial period of time.

What is Gang of Four (GOF)? In 1994, four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides published a book titled  Design Patterns - Elements of Reusable Object-Oriented Software  which initiated the concept of Design Pattern in Software development. According to these authors design patterns are primarily based on the following principles of object orientated design. Program to an interface not an implementation Favor object composition over inheritance

Design Pattern Design patterns  are typical solutions to commonly occurring problems in software design. They are like pre-made blueprints that you can customize to solve a recurring design problem in your code.

Design Pattern In software engineering, a  design pattern  is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.

What does the pattern consist of? Most patterns are described very formally so people can reproduce them in many contexts. Here are the sections that are usually present in a pattern description: Intent  of the pattern briefly describes both the problem and the solution. Motivation  further explains the problem and the solution the pattern makes possible. Structure  of classes shows each part of the pattern and how they are related. Code example  in one of the popular programming languages makes it easier to grasp the idea behind the pattern.

Why should we learn patterns? The truth is that you might manage to work as a programmer for many years without knowing about a single pattern. A lot of people do just that. Even in that case, though, you might be implementing some patterns without even knowing it. So why would you spend time learning them? Design patterns are a toolkit of  tried and tested solutions  to common problems in software design. Design patterns define a common language that you and your teammates can use to communicate more efficiently.

Need of Design pattern Enables efficient communication between designers. Solves an issue just by referring to pattern name. Improves code readability for coders. Reduce the time to find the solution by reusing tested and proven development paradigms. Reduce the time for coders. Introduces additional levels of indirection to achieve flexibility.

Need of Design pattern Reduce the time for understanding the design. Improves design understandability and documentation. Helps to understand the basics of object-oriented design more easily and quickly.

Usage of Design Pattern Common platform for developers Design patterns provide a standard terminology and are specific to particular scenario. Best Practices Design patterns have been evolved over a long period of time and they provide best solutions to certain problems faced during software development. Learning these patterns helps unexperienced developers to learn software design in an easy and faster way.

Benefits   of Design pattern Implementing design patterns in software development yields numerous benefits. These include: 1 . Code Reusability : Design patterns encourage the reuse of proven solutions, cut redundant code and save valuable development time. As a result, the use of design patterns improves production and efficiency in the  software development  process. 2. Scalability : Design patterns provide flexible structures. The structures can adjust to shifting needs and accommodate future expansions. This scalability ensures that software systems can grow without significant architectural overhaul.

Benefits   of Design pattern 3. Maintainability : By utilizing design patterns, code becomes more modular and easier to maintain. Developers can change specific software parts without impacting the entire application, which simplifies troubleshooting and updates. 4. Collaboration : Design patterns establish a widely-used language for developers, which also fosters effective communication and understanding of the software’s architecture. Communication enables seamless collaboration among team members, promoting synergy and collective problem-solving.

Classification of patterns Design patterns differ by their complexity, level of detail and scale of applicability to the entire system being designed. The most basic and low-level patterns are often called  idioms . They usually apply only to a single programming language. The most universal and high-level patterns are  architectural patterns . Developers can implement these patterns in virtually any language. Unlike other patterns, they can be used to design the architecture of an entire application.

Classification of patterns All patterns can be categorized by their  intent , or purpose. This book covers three main groups of patterns: Creational patterns  provide object creation mechanisms that increase flexibility and reuse of existing code. Structural patterns  explain how to assemble objects and classes into larger structures, while keeping these structures flexible and efficient. Behavioral patterns  take care of effective communication and the assignment of responsibilities between objects.

Essential Element of Design Pattern There are four essential elements of a design pattern. They are  as follows: Pattern Name Problem Solution Consequences

Essential Element of Design Pattern Pattern Name : It is a unique name that describes a design problem. Pattern name being concise and meaningful, Improves communication, among developers and helps to design patterns at higher levels of abstraction. Problem:  It states the problem and its context such as how to represent the algorithm as objects (It ensure when the pattern is applicable and what condition should be met before the pattern is used.

Essential Element of Design Pattern Solution:  It provides a Description of elements that make the design pattern such as their responsibility, relationship, and collaboration). Pattern solutions cant describe a particular implementation because patterns are like templates that are applicable to several similar situations. The solution gives a generic arrangement of classes and objects to solve a problem. Consequences:  As the name implies these highlight the result, pros and cons of applying the patterns, etc ,(It Describes the impacts on the system’s portability, extensibility. They determine the costs and evaluate design alternatives of pattern, language, and implementation issues.

The Catalog of Design Patterns The Design Patterns are organized into a form of a catalog. These Design Patterns collectively assist in software engineering by finding objects, specifying objects implementations, objects interfaces, determining objects granularity, implementing reuse mechanisms, etc. The Intents specify what the design pattern does.

The Catalog of Design Patterns Abstract Factory:  It Indicates what factory is to be instantiated, provides an interface to create families of objects(related / dependent) without any specification of their concrete classes.

The Catalog of Design Patterns Adaptor:  Id Adapt or converts an interface of a class into another one according to the client expectation and hence, overcomes the problem of incompatible interfaces thereby enabling the classes to work together.

The Catalog of Design Patterns Bridge:  It Separates abstraction from its implementation to make them independent.

The Catalog of Design Patterns Builder:  It Separates the complex objects constructions from their representation in order to create different representations with the same construction process.

The Catalog of Design Patterns Chain Of Responsibility:  It Enables the handling of command objects by passing them to other objects by using the logic present in the processing of objects. In other words, Its decouples sender and receiver by formatting a chain of receiving objects to pass the request until the request is handled by an object.

The Catalog of Design Patterns Command:  It encapsulates the action and its parameters and hence, enables to parameterize the different requests of the clients such as long or queue requests. It also assists undoable operations.

The Catalog of Design Patterns Composite:  It represents the objects in a tree structure where each object represents the same interface. This enables clients to treat individual objects and their compositions uniformly.

The Catalog of Design Patterns Decorator:  It Adds additional functionality to a class at runtime. This Enables flexibility to subclass for adding functionality.

The Catalog of Design Patterns Facade:  It creates a simplified/unified interface of existing interfaces in the subsystems so as to handle common tasks easily.

The Catalog of Design Patterns Factory Method:  It Focuses on objects creation of specific implementation. lets the subclass decide as to which class to be instantiated.

The Catalog of Design Patterns Flyweight:  It Performs sharing of common objects properties by a large number of objects to save space.

The Catalog of Design Patterns Interpreter:  It Deals with the implementation of a specified computer language that solves specific problems. It interprets sentences in language by representing the grammar of language along with an interpreter.

The Catalog of Design Patterns Iterator:  It Enables sequential aggregate objects elements by hiding their underlying representations.

The Catalog of Design Patterns Mediator:   It provides a unified interface to the set of interfaces in a subsystem. It provides loose coupling which enables objects to refer to each explicitly and also varies objects interaction independently.

The Catalog of Design Patterns Momento :  It supports the rollback mechanism by enabling the objects, to restore to their previous state without violation of encapsulation.

The Catalog of Design Patterns Observer:  Whenever an object changes its state, it raises an event that notifies other objects and updates them automatically. This defines a one-to-many dependency between the objects.

The Catalog of Design Patterns Prototype:   Here Prototypical instance determines the type of objects to be created. Further new objects are created by cloning this prototype.

The Catalog of Design Patterns proxy:  It provides an illusion by applying placeholder to other objects in order to have control over it.

The Catalog of Design Patterns Singleton:  It Provides restrictions on instantiating a class to a single object and also makes it globally accessible.

The Catalog of Design Patterns State:  It Permits an alteration in the object’s behavior with alteration in its state . i.e allows objects type to change at runtime.

The Catalog of Design Patterns Visitors:  It Describes the skeleton of a program, enables subclasses to define some steps of the algorithm, and also to redefine certain steps without affecting the structure of the algorithm.

The Catalog of Design Patterns Strategy:   It defines the Family of algorithms and their selection based upon the clients.

Conclusion Design patterns are indispensable tools for software developers. They provide reusable solutions to recurring design challenges. By leveraging design patterns, developers can enhance code reusability, scalability and maintainability. Familiarity with various design patterns and their appropriate usage empowers developers to build efficient and robust software applications. To use design patterns effectively, developers must first identify the problem or scenario that requires a solution. When the problem is identified, the most fitted design pattern can be selected. The implementation phase involves creating the necessary classes and interfaces and establishing the relationships specified by the chosen pattern.

References 1- https://refactoring.guru/design-patterns 2- https://www.geeksforgeeks.org/catalog-of-design-patterns/ 3- https://stackify.com/introduction-to-design-patterns-in-software-development/ 4-
Tags