topical media & game development

talk show tell print

object-oriented programming

patterns


Methods do not provide the intuiton and the direct access to solutions that work in real life. Design Patterns are the jewels, the cristals of Object Oriented Design ...


slide: Phrases ..

Motivation


Take for example a document processing system ...

  • material - words, images, tables
  • formatting, layout
  • online presentation and editing tool

slide: Document processing


Managing composites

Problem: very many items

Solution: flyweight class


slide: Composite ...



slide: Composite


Managing layout and formatting

Problem: many algorithms

Solution: composer (strategy) class


slide: Strategy ...



slide: Strategy


Display item with attributes

Problem: non-uniform attributes

Solution: embed and hide attributes


slide: Decorate ...



slide: Decorator


Develop multi-platform tools (1)

Problem: different window toolkits

Solution: employ platform-specific factories


slide: Factory ...



slide: Factory


Develop multi-platform tools (2)

Problem: offer uniform widget hierarchy

Solution: separate interface from implementation


slide: Bridge ...



slide: Bridge


Provide rich functionality

Problem: support commands with undo

Solution: abstract from specific commands


slide: Command ...



slide: Command

observer

Observer

one-to-many dependencies and notification


Consequences

  • abstract coupling between subject and observer
  • support for broadcast
  • deals with unexpected updates

slide: Observer Pattern


Implementation

  • mapping subjects to observers
  • observing more than one subject?
  • who triggers the update - subject or client of subject
  • dangling references to subject
  • consistency of subject (before notification)
  • adding observer-specific update protocols (push / pull)
  • specifying modifications of interest (aspects)
  • how to encapsulate update semantics

slide: Observer Pattern



(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.