Builder pattern
The Builder pattern allows a client to construct a complex object by specifying the type and content only. Construction details are hidden from the client entirely.
The most common motivation for using Builder is to simplify client code that creates complex objects. The client can still direct the steps taken by the Builder without knowing how the actual work is accomplished. Builders frequently encapsulate construction of Composite objects because the procedures involved are often repetitive and complex. Usually it is the last step that returns the newly created object which makes it easy for a Builder to participate in fluent interfaces in which multiple method calls, separated by dot operators, are chained together (note: fluent interfaces are implementation of the Chaining Pattern as presented in the Modern patterns section).
Builder dofactory – link
Builder dotnettutorials – link
Class code: builder – hamburger!
Observer pattern
The Observer pattern offers a subscription model in which objects subscribe to an event and get notified when the event occurs. This pattern is the cornerstone of event driven programming, The Observer pattern facilitates good object-oriented design and promotes loose coupling.
When building web apps you end up writing many event handlers. Event handlers are functions that will be notified when a certain event fires. These notifications optionally receive an event argument with details about the event (for example the x and y position of the mouse at a click event).
The observer pattern was the key idea behind events and delegates
Observer dofactory – link
Class code: observer – observing stock market – in Java!
Mediator pattern
The Mediator pattern provides central authority over a group of objects by encapsulating how these objects interact. This model is useful for scenarios where there is a need to manage complex conditions in which every object is aware of any state change in any other object in the group.
The Mediator patterns are useful in the development of complex forms. Take for example a page in which you enter options to make a flight reservation. A simple Mediator rule would be: you must enter a valid departure date, a valid return date, the return date must be after the departure date, a valid departure airport, a valid arrival airport, a valid number of travelers, and only then the Search button can be activated.
Another example of Mediator is of course a chat room when every message passes through a mediator which publishes only appropriate messages
Mediator dotnettutorials – chat room
Mediator dofactory – link
Class code: mediator – selling stocks – in Java!
More topics covered:
- different flavors of builder
- observer less relevant today because of events
Links:

