Information Systems Concepts Design Patterns - PowerPoint PPT Presentation

1 / 33
About This Presentation
Title:

Information Systems Concepts Design Patterns

Description:

Based on Chapter 15 of Bennett, McRobb and Farmer: ... The Tower Bridge = Bascule Suspension. 7. A Pattern. is a solution to a recurring problem ... – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 34
Provided by: stevem74
Category:

less

Transcript and Presenter's Notes

Title: Information Systems Concepts Design Patterns


1
Information Systems Concepts Design Patterns
  • Dell Zhang
  • Birkbeck, University of London
  • Spring 2009

Based on Chapter 15 of Bennett, McRobb and
Farmer Object Oriented Systems Analysis and
Design Using UML, (3rd Edition), McGraw Hill,
2005.
2
Outline
  • What Are Patterns
  • Part of Section 8.2 (pp. 223 229)
  • Framework
  • Section 15.2.1
  • Pattern Templates
  • Section 15.3.1 (p. 418)
  • Design Patterns
  • Section 15.4 (pp. 419 435)
  • Benefits and Dangers of Using Patterns
  • Section 15.6 (pp. 436 437)

3
What Are Patterns
A pattern describes a problem which occurs over
and over again in our environment, and then
describes the core of a 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. Alexander et al. (1977)
4
(No Transcript)
5
(No Transcript)
6
The Tower Bridge Bascule Suspension
7
What Are Patterns
  • A Pattern
  • is a solution to a recurring problem
  • is proven to be good (effective, )
  • is not obvious / trivial
  • is elegant

Patterns capture and document proven good
practices, while anti-patterns capture and
document demonstrably bad practices.
8
What Are Patterns
  • Patterns in software development
  • Organization patterns
  • the structures, roles and interactions in the
    software development organisation itself
  • Analysis patterns
  • the group of concepts useful in modelling
    requirements
  • Architectural patterns
  • the structure of major components of a software
    system
  • Design patterns
  • the structure and interaction of smaller software
    components

9
Pattern vs. Framework
  • A pattern is used to resolve a problem by
    applying a suitably contextualized solution.
  • A framework is a partially developed system that
    is essentially the core to a set of similar
    applications and is instantiated by adding the
    necessary program code.
  • Frameworks are similar to software libraries in
    that they are reuseable abstractions of code
    wrapped in a well-defined API.
  • Unlike libraries, however, the overall programs
    flow of control is not dictated by the caller,
    but by the framework.

10
Pattern vs. Framework
  • Web application frameworks
  • Java Struts, Cocoon, WebWork, etc.
  • PHP symfony, CodeIgniter, Zend, etc.
  • Ruby Ruby on Rails, etc.
  • Python Django, etc.

11
Pattern vs. Framework
  • Django
  • Django is an open source web application
    framework, written in Python, which loosely
    follows the model-view-controller design pattern.
  • Django's primary goal is to ease the creation of
    complex, database-driven websites.
  • Django emphasizes reusability and 'pluggability'
    of components, rapid development, and the
    principle of DRY (Don't Repeat Yourself).
  • Django also provides an optional administrative
    'CRUD' interface that is generated dynamically
    through introspection and configured via admin
    models.

12
Pattern vs. Framework
  • Django
  • The core Django framework consists of
  • an object-relational mapper which mediates
    between data models (defined as Python classes)
    and a relational database
  • a regular-expression-based URL dispatcher
  • a view system for processing requests
  • a templating system

13
(No Transcript)
14
Pattern vs. Framework
  • Their major differences
  • Patterns are more abstract and general than
    frameworks.
  • A pattern is a description of the way that a type
    of problem can be solved, but the pattern is not
    itself a implemented solution.
  • Unlike a framework, a pattern cannot be directly
    implemented in a particular software environment.
  • A successful implementation is only an example of
    a design pattern.
  • Patterns are more primitive than frameworks.
  • A framework can employ several patterns but a
    pattern cannot incorporate a framework.

15
Pattern Template
  • 5 main elements of a design pattern
  • Name a meaningful name that reflects the
    knowledge embodied by the pattern
  • Problem the problem that the pattern addresses,
    i.e., the intent of the pattern
  • Context the circumstances or preconditions under
    which it can occur
  • Forces the constraints or issues that must be
    addressed by the solution
  • Solution the description of the static and
    dynamic relationships among the components of the
    pattern

16
GOF Design Patterns
  • A catalogue of 23 design patterns presented by
    Gamma et al. (1995) known as the Gang of Four
    (GOF)

17
GOF Design Patterns
  • Typically address issues concerning changeability
    that involves several different aspects
  • Maintainability
  • Extensibility
  • Restructuring
  • Portability

18
GOF Design Patterns
  • Creational Patterns
  • Abstract Factory, Builder, Factory Method,
    Prototype, Singleton
  • Structural Patterns
  • Adapter, Bridge, Composite, Decorator, Façade,
    Flyweight, Proxy
  • Behavioural Patterns
  • Chain of Responsibility, Command, Interpreter,
    Iterator, Mediator, Memento, Observer, State,
    Strategy, Template Method, Visitor

19
Creational Patterns
  • Concerned with the construction of object
    instances
  • Separate the operation of an application from how
    its objects are created
  • Gives the designer considerable flexibility in
    configuring all aspects of object creation

20
Creational Patterns Singleton
  • How does one ensure that only one instance of the
    company class is created?

21
Creational Patterns Singleton
  • Solution restrict access to the constructor!

The use of class-scope operations allows global
access
22

Sequence Diagram for the Singleton Pattern
23

Different subclasses of Company can be
instantiated as needed.
24
Creational Patterns Singleton
General form of the Singleton pattern
25
Structural Patterns
  • Concerned with the way in which classes and
    objects are organized
  • Offer effective ways of using object-oriented
    constructs such as inheritance, aggregation and
    composition to satisfy particular requirements

26
Structural Patterns Composite
  • How can we present the same interface for a media
    clip whether it is composite or not?

27
Structural Patterns Composite
  • How can we incorporate composite structures?

28
Structural Patterns Composite
29
Structural Patterns Composite
General form of the Composite pattern
30
Behavioural Patterns
  • Address the problems that arise when assigning
    responsibilities to classes and when designing
    algorithms
  • Suggest particular static relationships between
    objects and classes and also describe how the
    objects communicate

31
Behavioural Patterns State
  • Consider the class Campaign
  • It has four states
  • Commissioned, Active, Completed and Paid
  • A Campaign object has different behaviour
    depending upon which state it occupies.
  • Operations have case statements giving this
    alternative behaviour
  • The class factored into separate components one
    for each of its states

32

The State pattern could be applied to the
Campaign class
33
Behavioural Patterns State
The Campaign class with the State pattern applied
34
Behavioural Patterns State
Some State pattern objects for Agate there are
6 Campaign objects sharing the four State objects.
35
Behavioural Patterns State
Sequence Diagram for the State Pattern
36
Behavioural Patterns State
General form of the State pattern
37
Benefits and Dangers
  • Benefits of Using Design Patterns
  • The introduction of a reuse culture at the design
    level
  • The rich source of development experience they
    offer
  • Dangers of Using Design Patterns
  • The inappropriate application of a pattern
  • Some limitation on creativity

38
Take Home Messages
  • What Are Patterns
  • Pattern vs Framework
  • Pattern Templates
  • GOF Design Patterns
  • Creational Patterns (e.g., Singleton)
  • Structural Patterns (e.g., Composite)
  • Behavioral Patterns (e.g., State)
  • Benefits and Dangers of Using Patterns
Write a Comment
User Comments (0)
About PowerShow.com