topical media & game development

talk show tell print

pattern(s) / matrix / model(s) / resource(s)

design patterns

design patterns


pattern(s) / matrix / model(s) / resource(s)

creational patterns

factory

provide interface for creating family of related or dependent objects without specifying their concrete classes

Example

also known as kit

participants

consequences

implementation

See GOF

factory method

define interface for creating an object, but let subclass decide which class to instantiate

also know as

virtual constructor

motivation

applicability

structure

participants

consequences

related

singleton

ensure a class has only one instance and provide a global point of access

applicability

implementation

     // .h file 
  
     class Singleton {
     public:
  	static Singleton instance();
     protected: 
limit access
Singleton(); private: static Singleton* _instance; }; // .c file Singleton* Singleton::_instance = 0; Singleton* Singleton::instance() { if (_instance == 0) _instance = new Singleton(); return _instance; }

consequences

etcetera

see GOF

prototype

specify kinds of objects to create using a prototypical instance and create by copying this prototype

motivation

applicability

participants

consequences

related

pattern(s) / matrix / model(s) / resource(s)

structural patterns

structural patterns

are concerned with how classes and objects are composed to form larger structures
PatternAliasRemarks

language mechanisms

adaptor vs bridge

wrapper

Composite vs Decorator vs Proxy

recursive composition

pattern(s) / matrix / model(s) / resource(s)

behavioral patterns

behavioral patterns

communication

deal with algorithms and the assignment of responsibilities between objects

class

object

composition

encapsulating behavior

objectify!

observer

one-to-many dependencies and notification

structure

consequences

implementation


[] readme course(s) preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthought(s) appendix reference(s) example(s) resource(s) _

(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.