Fresh Blurbs

Common Software Design Patterns

Adapted from: Head First Design Patterns. Please buy the book, it's quite amazing.

Also check out: Big-O Cheat Sheet

Abstract Factory

Provides an interface for creating families of related or dependent objects without specifying their concrete classes

Adapter

Converts interface of a class to another interface that a consumer expects. The consumer would not be able to use the original class otherwise.

Command

Encapsulates a request as an object

Composite

Allows composing objects into tree structures, to describe hierarchy. Lets consumers treat individual objects and compositions uniformally.

Decorator

A flexible way to attach functionality to an object dynamically, without using subclassing.

Fa├žade

Provides a higher-level interface that provides simpler way of interacting with a composite system than using the individual interfaces of the components that make up the system.

Factory Method

Interface for creating an object, but lets subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses

Iterator

A universal way to access elements of an aggregate object sequentially, regardless of the inner nature or implementation of the aggregate object.

MVC

Common approach to complex application design that separates code components into three buckets: Models, Views and Controllers, allowing seperation of business logic from the presentation.

Observer

Observer pattern provides a mechanism to establish one-to-many dependency between objects, so that "dependents" can be notified when the "observed" object changes its state.

Proxy (Protection, Remote, Virtual)

A proxy object is a surrogate or a placeholder for another object. Typical use-cases include when access to the "original" object needs to be protected because it is either: requiring security (Protection Proxy), happens over-the-network (Remote) or is otherwise expensive (Virtual).

Singleton

Ensure that a class has only one instance and provide global pont of access to that instance.

State

A way for an object to change its behavior based on its internal state. Typically used as a cleaner alternative to long list of conditional statements. Similar in nature to the Strategy pattern.

Strategy

Provides a way to encapsulate interchangeable algorithms, selecting which algorithm to use at runtime.

Template Method

defines the skeleton of an algorithm in a method, deferring some steps to subclasses. Subclasses may redefne some steps of the algorithm at runtime, without changing the algorithm structure.

comments powered by Disqus