Wednesday, January 8, 2014

Patterns and problems

I was reminded of patterns when I read E.O wilson's Letters to a Young Scientist that every form of life is an answer to a problem.

Here is a short list of patterns and problems they attempt to answer


Pattern Problem
Singleton Only one instance of an object
Strategy Apply functionality only where needed - not the whole inheritance chain
Avoid multiple switch statements
Observer Loosely coupled way to notify
Template force child classes to implement what they need (by making those methods abstract) , but follow the parents process
Factory Method Method for subclasses to create correct class 
Works in tandem with strategy
Abstract Factory Defer concrtete implementation for child classes
Avoid multiple switch statements
A way to have multiple versions of a class
Façade Simplify gateway to single/multiple interfaces
Command Loosely coupled way to execute a method
good for Qeues

No comments:

Post a Comment