SlideShare a Scribd company logo
Design Pattern From Theory to Practice Thomas Wiradikusuma [email_address] www.wiradikusuma.com Presentation to the 21 st  Java User Group Meet Up (JaMU), August 12, 2006
Agenda Introduction to design pattern Some implementations in Java Study group
Objective To emphasize the importance of design patterns to develop better software.
Introduction to Design Pattern Design pattern is a general repeatable solution to a commonly-occurring problem in software design. Old idea, made popular by Gamma  et al  (Design Patterns -- Elements of Reusable Software, 1995).
Characteristics of Patterns Good  patterns do the following:  It solves a problem:  Patterns capture solutions, not just abstract principles or strategies.  It is a proven concept:  Patterns capture solutions with a track record, not theories or speculation.  The solution isn't obvious:  Many problem-solving techniques (such as software design paradigms or methods) try to derive solutions from first principles. The best patterns generate a solution to a problem indirectly -- a necessary approach for the most difficult problems of design.  It describes a relationship:  Patterns don't just describe modules, but describe deeper system structures and mechanisms.  The pattern has a significant human component  .... All software serves human comfort or quality of life; the best patterns explicitly appeal to aesthetics and utility.  Patterns are Useful, Useable, and Used.
Elements of a Pattern Name   It must have a meaningful name. Problem   A statement of the problem which describes its  intent : the goals and objectives it wants to reach within the given context and forces. Context  / Applicability The  preconditions  under which the problem and its solution seem to recur, and for which the solution is desirable. Forces   A description of the relevant  forces  and constraints and how they interact/conflict with one another and with goals we wish to achieve (perhaps with some indication of their priorities). Solution   Static relationships and dynamic rules describing how to realize the desired outcome. This is often equivalent to giving instructions which describe how to construct the necessary work products.
Elements of a Pattern, cont’d Examples   One or more sample applications of the pattern which illustrate: a specific initial context; how the pattern is applied to, and transforms, that context; and the resulting context left in its wake. Resulting Context   The state or configuration of the system after the pattern has been applied, including the  consequences  (both good and bad) of applying the pattern, and other problems and patterns that may arise from the new context. Rationale   A justifying explanation of steps or rules in the pattern, and also of the pattern as a whole in terms of how and why it resolves its forces in a particular way to be in alignment with desired goals, principles, and philosophies. Related Patterns   The static and dynamic relationships between this pattern and others within the same pattern language or system. Related patterns often share common forces. Known Uses   Describes known occurrences of the pattern and its application within existing systems.
Qualities of a Pattern Encapsulation and Abstraction   Each pattern encapsulates a well-defined problem and its solution in a particular domain. Openness and Variability   Each pattern should be open for extension or parameterization by other patterns so that they may work together to solve a larger problem. Generativity and Composability   Each pattern, once applied, generates a resulting context which matches the initial context of one or more other patterns in a pattern language. Equilibrium   Each pattern must realize some kind of balance among its forces and constraints.
Patterns and Algorithms Algorithms and data structures generally solve more fine-grained computational problems like sorting and searching.  Patterns are typically concerned with broader architectural issues that have larger-scale effects.
Patterns and Frameworks A software framework is a reusable mini-architecture that provides the generic structure and behavior for a family of software abstractions, along with a context of memes/metaphors which specifies their collaboration and use within a given domain. A framework is usually not a complete application: it often lacks the necessary application-specific functionality. Frameworks employ an inverted flow of control between itself and its clients.
Patterns and Frameworks, cont’d Design patterns may be employed both in the design and the documentation of a framework. A single framework typically encompasses several design patterns. A framework can be viewed as the implementation of a system of design patterns.  Frameworks and design patterns are distinct: a framework  is executable software , design patterns represent knowledge and experience  about software . Frameworks are of a physical nature, patterns are of a logical nature: frameworks are the  physical realization  of one or more software pattern solutions; patterns are the instructions for  how to implement  those solutions.  Major differences: Design patterns are more abstract than frameworks. Design patterns are smaller architectural elements than frameworks. Design patterns are less specialized than frameworks.
Anti-patterns Represents a "lesson learned." Initially proposed by Andrew Koenig in the November 1995 C++ Report. Notions: Those that describe a bad solution to a problem which resulted in a bad situation. Those that describe how to get out of a bad situation and how to proceed from there to a good solution.
Other patterns Analysis, development organization, software process, project planning, requirements engineering, and software configuration management, and many more.
Patterns Category by GoF Creational patterns Abstract factory pattern Builder Factory method pattern Prototype Singleton
Patterns Category by GoF, cont’d Structural patterns Adapter Bridge Composite Decorator Flyweight Proxy
Patterns Category by GoF, cont’d Behavioral patterns Chain of responsibility Command Interpreter Iterator Mediator Memento Observer State Strategy Template method Visitor

More Related Content

PPT
Introduction to design patterns
PPTX
Design patterns
PPT
Software Design Patterns
PDF
Introduction to Design Pattern
PPTX
Design Patterns - General Introduction
PDF
Design Patterns Presentation - Chetan Gole
PPTX
Design pattern
PPTX
Introduction to design patterns
Design patterns
Software Design Patterns
Introduction to Design Pattern
Design Patterns - General Introduction
Design Patterns Presentation - Chetan Gole
Design pattern

What's hot (20)

PPT
Software Design Patterns
PPTX
Let us understand design pattern
PPTX
Design pattern-presentation
PPT
Design Patterns
PDF
Design patterns
PPT
Design patterns ppt
PDF
Design patterns tutorials
PPT
Design Patterns
PPTX
Software Architecture Design Decisions
PPTX
Gof design patterns
PDF
Object-oriented Programming-with C#
PPTX
C# classes objects
PPTX
Component level design
PPTX
Quality Attributes In Software Architecture & Design Patterns
PPT
Facade pattern
PPTX
Design Pattern in Software Engineering
PDF
CS8592-OOAD Lecture Notes Unit-1
PPT
Object Oriented Programming In .Net
PPTX
Design pattern - Facade Pattern
PPTX
Integrative Programming Technology Chapter 5 - Dr. J. VijiPriya
Software Design Patterns
Let us understand design pattern
Design pattern-presentation
Design Patterns
Design patterns
Design patterns ppt
Design patterns tutorials
Design Patterns
Software Architecture Design Decisions
Gof design patterns
Object-oriented Programming-with C#
C# classes objects
Component level design
Quality Attributes In Software Architecture & Design Patterns
Facade pattern
Design Pattern in Software Engineering
CS8592-OOAD Lecture Notes Unit-1
Object Oriented Programming In .Net
Design pattern - Facade Pattern
Integrative Programming Technology Chapter 5 - Dr. J. VijiPriya
Ad

Viewers also liked (11)

PPTX
Design patterns
PPT
5 Design Patterns Explained
PPT
CS6201 Software Reuse - Design Patterns
PPT
Design patterns
PPTX
Designpattern
PPT
MVC and Other Design Patterns
PDF
Creational Design Patterns
PPTX
How I Learned To Apply Design Patterns
PPT
Introduction to Design Patterns and Singleton
PDF
Design Patterns : Solution to Software Design Problems
PDF
Software Design Patterns - Selecting the right design pattern
Design patterns
5 Design Patterns Explained
CS6201 Software Reuse - Design Patterns
Design patterns
Designpattern
MVC and Other Design Patterns
Creational Design Patterns
How I Learned To Apply Design Patterns
Introduction to Design Patterns and Singleton
Design Patterns : Solution to Software Design Problems
Software Design Patterns - Selecting the right design pattern
Ad

Similar to Design Pattern (20)

PPT
test download file iehle-Zullighoven-p235.ppt
PPT
Design pattern & categories
PPTX
Cs 1023 lec 9 design pattern (week 2)
PDF
Patterns Overview
PPT
Class (1)
PDF
Discovering patterns
PDF
Module 2 design patterns-2
PPTX
PPT
Introduction to Patterns (miniPLoP@Taipei)
PPT
Chapter 12
DOCX
Unit iii design patterns 9
PPT
6 Design Pattern.ppt design pattern in softeare engineering
PPT
Chapter 4_Introduction to Patterns.ppt
PPT
Chapter 4_Introduction to Patterns.ppt
PPTX
2014 asdenca - An outlook on patterns as an aid for business and it alignment...
PPT
Slides chapter 9
PPTX
Design patterns
PPT
Design Patterns
PPT
Design Patterns.ppt
PPTX
Final sdp ppt
test download file iehle-Zullighoven-p235.ppt
Design pattern & categories
Cs 1023 lec 9 design pattern (week 2)
Patterns Overview
Class (1)
Discovering patterns
Module 2 design patterns-2
Introduction to Patterns (miniPLoP@Taipei)
Chapter 12
Unit iii design patterns 9
6 Design Pattern.ppt design pattern in softeare engineering
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
2014 asdenca - An outlook on patterns as an aid for business and it alignment...
Slides chapter 9
Design patterns
Design Patterns
Design Patterns.ppt
Final sdp ppt

More from wiradikusuma (9)

KEY
Practical OOP In Java
ODP
Open Source And Java
ODP
Open Source is Not An Alternative, It is The Solution
PPT
Spring 2.1 Exposed
PPT
A Taste of Java ME
PPT
Subversion
PPT
Spring and DWR
PPT
OOP in Java
PPT
Introducing Struts 2
Practical OOP In Java
Open Source And Java
Open Source is Not An Alternative, It is The Solution
Spring 2.1 Exposed
A Taste of Java ME
Subversion
Spring and DWR
OOP in Java
Introducing Struts 2

Recently uploaded (20)

PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
Tartificialntelligence_presentation.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Getting Started with Data Integration: FME Form 101
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPT
Teaching material agriculture food technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
OMC Textile Division Presentation 2021.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
cloud_computing_Infrastucture_as_cloud_p
A comparative analysis of optical character recognition models for extracting...
Tartificialntelligence_presentation.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Group 1 Presentation -Planning and Decision Making .pptx
Unlocking AI with Model Context Protocol (MCP)
Mobile App Security Testing_ A Comprehensive Guide.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Getting Started with Data Integration: FME Form 101
SOPHOS-XG Firewall Administrator PPT.pptx
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
NewMind AI Weekly Chronicles - August'25-Week II
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Teaching material agriculture food technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
TLE Review Electricity (Electricity).pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
OMC Textile Division Presentation 2021.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
cloud_computing_Infrastucture_as_cloud_p

Design Pattern

  • 1. Design Pattern From Theory to Practice Thomas Wiradikusuma [email_address] www.wiradikusuma.com Presentation to the 21 st Java User Group Meet Up (JaMU), August 12, 2006
  • 2. Agenda Introduction to design pattern Some implementations in Java Study group
  • 3. Objective To emphasize the importance of design patterns to develop better software.
  • 4. Introduction to Design Pattern Design pattern is a general repeatable solution to a commonly-occurring problem in software design. Old idea, made popular by Gamma et al (Design Patterns -- Elements of Reusable Software, 1995).
  • 5. Characteristics of Patterns Good patterns do the following: It solves a problem: Patterns capture solutions, not just abstract principles or strategies. It is a proven concept: Patterns capture solutions with a track record, not theories or speculation. The solution isn't obvious: Many problem-solving techniques (such as software design paradigms or methods) try to derive solutions from first principles. The best patterns generate a solution to a problem indirectly -- a necessary approach for the most difficult problems of design. It describes a relationship: Patterns don't just describe modules, but describe deeper system structures and mechanisms. The pattern has a significant human component .... All software serves human comfort or quality of life; the best patterns explicitly appeal to aesthetics and utility. Patterns are Useful, Useable, and Used.
  • 6. Elements of a Pattern Name It must have a meaningful name. Problem A statement of the problem which describes its intent : the goals and objectives it wants to reach within the given context and forces. Context / Applicability The preconditions under which the problem and its solution seem to recur, and for which the solution is desirable. Forces A description of the relevant forces and constraints and how they interact/conflict with one another and with goals we wish to achieve (perhaps with some indication of their priorities). Solution Static relationships and dynamic rules describing how to realize the desired outcome. This is often equivalent to giving instructions which describe how to construct the necessary work products.
  • 7. Elements of a Pattern, cont’d Examples One or more sample applications of the pattern which illustrate: a specific initial context; how the pattern is applied to, and transforms, that context; and the resulting context left in its wake. Resulting Context The state or configuration of the system after the pattern has been applied, including the consequences (both good and bad) of applying the pattern, and other problems and patterns that may arise from the new context. Rationale A justifying explanation of steps or rules in the pattern, and also of the pattern as a whole in terms of how and why it resolves its forces in a particular way to be in alignment with desired goals, principles, and philosophies. Related Patterns The static and dynamic relationships between this pattern and others within the same pattern language or system. Related patterns often share common forces. Known Uses Describes known occurrences of the pattern and its application within existing systems.
  • 8. Qualities of a Pattern Encapsulation and Abstraction Each pattern encapsulates a well-defined problem and its solution in a particular domain. Openness and Variability Each pattern should be open for extension or parameterization by other patterns so that they may work together to solve a larger problem. Generativity and Composability Each pattern, once applied, generates a resulting context which matches the initial context of one or more other patterns in a pattern language. Equilibrium Each pattern must realize some kind of balance among its forces and constraints.
  • 9. Patterns and Algorithms Algorithms and data structures generally solve more fine-grained computational problems like sorting and searching. Patterns are typically concerned with broader architectural issues that have larger-scale effects.
  • 10. Patterns and Frameworks A software framework is a reusable mini-architecture that provides the generic structure and behavior for a family of software abstractions, along with a context of memes/metaphors which specifies their collaboration and use within a given domain. A framework is usually not a complete application: it often lacks the necessary application-specific functionality. Frameworks employ an inverted flow of control between itself and its clients.
  • 11. Patterns and Frameworks, cont’d Design patterns may be employed both in the design and the documentation of a framework. A single framework typically encompasses several design patterns. A framework can be viewed as the implementation of a system of design patterns. Frameworks and design patterns are distinct: a framework is executable software , design patterns represent knowledge and experience about software . Frameworks are of a physical nature, patterns are of a logical nature: frameworks are the physical realization of one or more software pattern solutions; patterns are the instructions for how to implement those solutions. Major differences: Design patterns are more abstract than frameworks. Design patterns are smaller architectural elements than frameworks. Design patterns are less specialized than frameworks.
  • 12. Anti-patterns Represents a "lesson learned." Initially proposed by Andrew Koenig in the November 1995 C++ Report. Notions: Those that describe a bad solution to a problem which resulted in a bad situation. Those that describe how to get out of a bad situation and how to proceed from there to a good solution.
  • 13. Other patterns Analysis, development organization, software process, project planning, requirements engineering, and software configuration management, and many more.
  • 14. Patterns Category by GoF Creational patterns Abstract factory pattern Builder Factory method pattern Prototype Singleton
  • 15. Patterns Category by GoF, cont’d Structural patterns Adapter Bridge Composite Decorator Flyweight Proxy
  • 16. Patterns Category by GoF, cont’d Behavioral patterns Chain of responsibility Command Interpreter Iterator Mediator Memento Observer State Strategy Template method Visitor