Saturday, June 14, 2014

Adapter, decorator, and facade patterns

Decorator: wraps the interface of a class to add functionality. This can be done by delegating or subclassing.

Adapter: maps one interface to an expected interface. This is so client code doesn't need to be changed when an interface changes. This can be done by subclassing the expected interface and wrap-and-map the unexpected interface.

Facade: take a complex interface, which may be composed of several classes, and simplify the interface with a Facade class that hides lots of the details.

No comments:

Post a Comment

There was an error in this gadget