... the focus of my carrer.
People doing this are also doing these things:
Entries
My favorite pattern is visitor, probably because its one of the few patterns that I never came up on my own, before learning about patterns. There were a period when I went pattern-crazy.
Now I don’t use patterns everyday and everywhere. Its only sometimes.
One of the most useful and most elegant design patterns. You can have watchers for an object - observers - that get notified if any event happened—to the subject they’re interested.
The subject, object being observed, contains a list of registered watchers. If an event occurs, the list is traversed, and the watchers are notified if something happens.
Memento’s main objective is to preserve state and have the ability to restore it.
It’s intent, as the GoF book states, is “without violating encapsulation, capture and externalize an object’s internal state so that the object can be restored to this state later.”
The Head First book says that in Java you could use Serialization to preserve object’s state.
One of the extra advantages of the Iterator is that, besides encapsulating the data structure and only exposing the iteration part, is that it allows you to create more than one iterator on the same aggregate, ie, create filters on the data.
Or it could be called “Dictator.” :-)
This pattern centralizes the control to the mediator, or director. Each object has a reference to the mediator and if the object changes, it notifies the mediator. Mediator in turn, might call other objects to update themselves.
The GoF book’s example is a set of widgets. The mediator has a reference to all of them, and each of the widgets have a reference to the director. If a widget changes, for instance if the user types some text, the widget notifies the director. The director then, calls a dependent widget to modify itself.
This pattern introduces low coupling in an otherwise high coupling situation. Each widget has to talk to only one object, as opposed to having to talk to many. This pattern breaks many-to-many relationship to one-to-many.
When you call a company and want to talk to its president, you will talk to the secretary first. She will decide whether you can, and schedule an appointment for you. In essence, she’s a Proxy to the president. Before you can get in touch with him, you have to go through her. Proxy is the middle guy between you and the desired object: it’s the access controller to the object. Proxy can server several purposes: security, caching, and others.
It’s a fairly simple but useful pattern. As a Java programmer, I am using it all the time. How? When I want to iterate over a list of elements in another object, I use it. Iterator encapsulates how elements are stored so and only exposes the Iteration part. Neat.
Bridge is not an easy pattern to understand. I understand it in general: seperate the implementation from the interface. But I don’t really see how I could use it. I guess I don’t get it yet. :-)
Builder helps with the creation of complex objects. Here’s how it works. A Client creates a ConcreteBuilder and forwards it to a Director. The Client tells the director to contruct() the object. The Director interacts with the builder to build the object that the Client wants. Client is unaware of what’s going on. Client just calls the ConcreteBuilder to get the resulting object (not sure why it does not ask the Director for that).



