design patterns l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Design Patterns PowerPoint Presentation
Download Presentation
Design Patterns

Loading in 2 Seconds...

play fullscreen
1 / 41

Design Patterns - PowerPoint PPT Presentation


  • 135 Views
  • Uploaded on

Design Patterns. Weslei A. de T. Marinho. Talk Outline. Pattern Definition GRASP Patterns GoF Patterns GoF Patterns Classification Creational Patterns Structural Patterns. What is a Pattern?.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Design Patterns' - leoma


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
design patterns

Design Patterns

Weslei A. de T. Marinho

talk outline
Talk Outline
  • Pattern Definition
  • GRASP Patterns
  • GoF Patterns
    • GoF Patterns Classification
    • Creational Patterns
    • Structural Patterns
what is a pattern
What is a Pattern?

"Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice“ (Christopher Alexander)

what is a pattern4
What is a Pattern?
  • “Pattern is a named and well-known problem/solution pair that can be applied in new contexts, with advice on how to apply it in novel situations and discussion of its trade-offs, implementations, variations, and so forth.” (Craig Larman)
why use patterns
Why use Patterns?
  • A pattern addresses a recurring design problem that arises in specific design situations, and presents a solution to it.
  • Patterns document existing, well-proven design experience.
  • Patterns identify and specify abstractions that are above the level of single classes and instances, or of components.
  • Patterns provide a common vocabulary and understanding for design principles
  • Patterns are a means of documenting software architectures.
why use patterns6
Why use Patterns?
  • Patterns support the construction of software with defined properties.
  • Patterns help you build complex and heterogeneous software architectures.
  • Patterns help you to manage software complexity.
types of patterns
Types of Patterns
  • GRASP Patterns
  • Architectural Patterns
  • Design Patterns
  • Idioms
  • E.g.: Usability Patterns
  • Anti-Patterns
basic pattern metamodel
Basic Pattern Metamodel

Pattern

Problem

Solution

name

*

Consequence

gof pattern metamodel
GoF Pattern Metamodel

SampleCode

ExampleDomain

Intent

*

*

A.K.A

*

Issues

*

Pattern

relPatterns

*

name

Motivation

(ExampleScenario)

classification

Implementation

Issue

Consequence

Participant

Applicability

(Problem)

*

*

*

Structure

(SolutionGraphicalDescription)

ClassDiagram

BehavioralStructure

(Collaboration)

StaticStructure

ObjectDiagram

grasp patterns
GRASP Patterns
  • GRASP stands for General Responsibility Assignment Software Pattern
  • Will be presented the following GRASP Patterns:
    • Information Expert
    • Creator
    • Low Coupling
    • High Cohesion
creator
Creator

B is a creator of A objects.

If more than one option applies, usually prefer a class B which aggregates or contains class A.

information expert
Information Expert

Problem: Who knows about a Square object, given a key?

information expert14
Information Expert

How to distribute the responsibilities for obtain the sale’s total?

low coupling
Low Coupling

Given following classes:

What is better for a makePayment design?

A:

B:

In practice, the level of coupling alone can't be considered in isolation from other principles such as Expert and High Cohesion. Nevertheless, it is one factor to consider in improving a design.

high cohesion17
High Cohesion
  • Low cohesion implies on code:
    • Hard to comprehend
    • Hard to reuse
    • Hard to maintain
    • Delicate; constantly affected by change

In practice, the level of cohesion alone can't be considered in isolation from other responsibilities and other principles such as Expert and Low Coupling.

gof patterns classification
GoF Patterns Classification

Table 1:  Designpatternspace

abstract factory
Abstract Factory
  • Intent: Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
  • Also Knows As: Kit
builder
Builder
  • Intent: Separate the construction of a complex object from its representation so that the same construction process can create different representations.
sigleton
Sigleton
  • Intent: Ensure a class only has one instance, and provide a global point of access to it.
facade
Facade
  • Intent: Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.
bibliography
Bibliography
  • Freeman, E., Sierra, K., Bates, B. 2004. Head First Design Patterns. O’Reilly Media, Inc.
  • Gamma, E., Helm, R., Johnson, R., Vlissides, J. 1995. Design Patterns Elements of Reusable Object-Oriented Software. Addison-Wesley Pub Co.
  • Larman, C. 2004. Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, Third Edition. Pearson Education, Inc.
  • Schmidt, D., Stal, M., Rohnert, H., Buschmann, F. 1996. PATTERN-ORIENTED SOFTWARE ARCHITECTURE VOLUME 1: A System of Patterns. John Wiley & Sons Ltd.