FrontPage FindPage TitleIndex RecentChanges UserPreferences E D R S I H C
 
CS533 Design Patterns (2007 Winter)
KSEA2008SponsorsWordIndexCategoryCpluspluscheap-airfare-nyc-238WikiWord › DesignPatterns

Singleton


A class which has only one instance.

  • private ctor
  • public static getInstance method

Serialization, concurrency, garbage collection can introduce problems.

Immutable


An object's state should never change.

  • member variables may be defined as final
  • ctor initializes member variables (or internal states)
  • no menthod modifies member variables (or internal states)

Related pattern: Read-Only Interface

Marker


To mark semantic attribute with no specific members.

  • a class implements an empty interface
  • a utility operation can recognize the marker with instanceof keyword

java.io.Serializable and java.rmi.Remote are markers.


Proxy


Access an object's service indirectly through another object called proxy, generally without letting the client know.

  • a service class provides the service
  • through proxy class, a client can access the service
  • there is a COMMON INTERFACE of both the service class and the proxy class

Virtual Proxy is a proxy that creates the service object on demand.

Abstract Factory


Provides an interface for creating family of objects without specifying their concrete classes.

  • AbstractFactory AbstractProduct ConcreteFactory ConcreteProduct Client
  • call methods to create objects instead of the new keyword with a concrete class names

Factory Method


Factory that has a creator method which creates a product composed of several components.

  • an abstract class declares a creator method returning the product
  • subclass usually overrides the methods creating the components but use the same creator for the product.

Factory Method is like a virtual ctor.

Prototype


Factory that clones an existing object rather than creating it.

Object Pool


  • classes: Reusable, ReusablePool, Client
  • ReusablePool methods: acquire, release

Layered Initialization




Filter


Iterator


Facade

last modified 2009-03-09 12:46:41
EditTextFindPageDeletePageLikePages