Patterns

From HaFrWiki
Jump to: navigation, search

Introduction

Patterns exist in nature (Dunes, Grand Canyon), art (Modern, Impressionism), science and mathematics (Fractals, Crystals) and Computer Science (Design Patterns).

Christopher Alexander says, 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 [1]. Even though Alexander was talking about patterns in buildings and towns, what he says is true about object-oriented design patterns

Designing object-oriented software is hard, and designing reusable object-oriented software is even harder. Experienced object-oriented designers will tell you that a reusable and flexible design is difficult if not impossible to get "right" the first time. Before a design is finished, they usually try to reuse it several times, modifying it each time. [2]

Computer Science Patterns (Design Patterns)

All well-structured systems are full of patterns. A pattern provides a common solution to a common problem in a given context. A mechanism is a design pattern that applies to a society of classes; a framework is typically an architectural pattern that provides an extensible template for applications within a domain.

Patterns are used to specify mechanisms and frameworks that shape the architecture of your system.

Classification

Design Pattern Sub-Design Pattern
Fundamental Delegation
Functional
Interface
Proxy
Immutal
Marker Interface
Creational Abstract Factory
Anonymous Subroutine
Builder
Factory Method
Lazy initialization
Prototype
Singleton
Structural Adapter
Bridge
Composite
Container
Decorator
Extensibility
Facade
Flyweight
Proxy
Pipes and Filters
Private Class
Design Pattern Sub-Design Pattern
Behavioral Chain of responsibility
Command
Event listener
Interpreter
Iterator
Mediator
Memento
Observer
State
Strategy
Template method
Visitor
Single-serving visitor
Hierarchical visitor
Concurrency Action at a distance
Active Object
Balking pattern
Double checked locking
Guarded suspension
Half-Sync/Half-Async
Leaders/followers
Monitor Object
Read write lock
Scheduler
Thread pool
Thread-Specific Storage
Event handling  
Architecture  
Patterns Map
 

Short description

Design Pattern Design Description
Abstract Factory Creational Creates an interface for creating families of related or dependent objects without specifying their concrete classes.
Adapter Structural Converts the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.
Bridge Structural Decouples an abstraction from its implementation so that the two can vary independently.
Builder Creational Separates the construction of a complex object from its representation so that the same construction process can create different representations.
Chain of Responsibility Behavioral Avoids coupling the sender of a request to its receiver by giving more than one object a chance to handle the request.
Chain the receiving objects and pass the request along the chain until an object handles it.
Command Behavioral Encapsulates a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.
Composite Structural Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
Decorator Structural Attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
Extensibility Structural The implementation takes future growth into consideration.
Facade Structural Provides a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.
Factory Method Creational Defines an interface for creating an object, but let subclasses decide which class to instantiate.
Factory Method lets a class defer instantiation to subclasses.
Flyweight Structural Uses sharing to support large numbers of fine-grained objects efficiently.
Interpreter Behavioral Given a language, defines a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
Iterator Behavioral Provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
Mediator Behavioral Defines an object that encapsulates how a set of objects interact.
Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.
Memento Behavioral Without violating encapsulation, captures and externalizes an object's internal state so that the object can be restored to this state later.
Observer Behavioral Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
Prototype Creational Specifies the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
Proxy Structural Provides a surrogate or placeholder for another object to control access to it.
Singleton Creational Ensures a class only has one instance, and provide a global point of access to it.
State Behavioral Allows an object to alter its behavior when its internal state changes. The object will appear to change its class.
Strategy Behavioral Defines a family of algorithms, encapsulate each one, and make them interchangeable.
Strategy lets the algorithm vary independently from clients that use it.
Template Method Behavioral Defines the skeleton of an algorithm in an operation, deferring some steps to subclasses.
Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.
Visitor Behavioral Represents an operation to be performed on the elements of an object structure.
Visitor lets you define a new operation without changing the classes of the elements on which it operates.

See also

Modeling

Books

top

Authors

  • Grady Booch (born February 27, 1955) is an American software engineer, best known for developing the Unified Modeling Language (UML) with Ivar Jacobson and James Rumbaugh.
  • Martin Fawler ((born 1963) is a British software developer, author and international public speaker on software development, specializing in object-oriented analysis and design, UML, patterns, and agile software development methodologies, including extreme programming.
  • Erich Gamma (BoF) (born March 13, 1961 in Zürich) is a Swiss computer scientist and co-author of the influential software engineering textbook, Design Patterns: Elements of Reusable Object-Oriented Software. He co-wrote the JUnit software testing framework with Kent Beck and led the design of the Eclipse platform's Java Development Tools (JDT). He also worked on the IBM Rational Jazz project.
  • Richard Helm (Wikipedia.de) (BoF), ist Informatiker und Mitautor des Buches „Design Patterns – Elements of Reusable Object-Oriented Software“ (Entwurfsmuster), welches er gemeinsam mit Erich Gamma, Ralph Johnson und John Vlissides verfasste. Die vier Autoren werden auch als Viererbande (Gang Of Four) bezeichnet. Sie wurden 1998 mit dem Dr. Dobb's Journal Excellence in Programming Preis und 2006 mit dem AITO Dahl-Nygaard-Preis ausgezeichnet.
  • Ivar Jacobson (born September 2, 1939) is a Swedish computer scientist and software engineer, known as major contributor to UML, Objectory, Rational Unified Process (RUP), aspect-oriented software development and Essence.
  • Ralph Johnson (BoF) (born October 7, 1955) is a Research Associate Professor in the Department of Computer Science at the University of Illinois at Urbana-Champaign. He is a co-author of the influential computer science textbook Design Patterns: Elements of Reusable Object-Oriented Software.
  • James E. Rumbaugh (born August 22, 1947) is an American computer scientist and object-oriented methodologist who is best known for his work in creating the Object Modeling Technique (OMT) and the Unified Modeling Language (UML).
  • John Vlissides (BoF) (August 2, 1961 - November 24, 2005) was a software scientist known mainly as one of the four authors (referred to as the Gang of Four) of the book Design Patterns: Elements of Reusable Object-Oriented Software. Vlissides referred to himself as #4 of the Gang of Four and wouldn't have it any other way.

See also

top

Reference

top

  1. Christopher Alexander, Sara Ishikawa, Murray Silverstein, Max Jacobson, Ingrid Fiksdahl-King, and Shlomo Angel. A Pattern Language. Oxford University Press, New York, 1977.
  2. Design Patterns: Elements of Reusable Object-Oriented Software, The Gang of Four (GoF), Authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides with a foreword by Grady Booch, 1994, ISBN 0-201-63361-2. There are PDF files of the book on the internet.