Tutorial by Examples

Observer Pattern's intent is to define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. The subject and observers define the one-to-many relationship. The observers are dependent on the subject such that when ...
Convert the interface of a class into another interface clients expect. Adapter (or Wrapper) lets classes work together that couldn't otherwise because of incompatible interfaces. Adapter pattern's motivation is that we can reuse existing software if we can modify the interface. Adapter pattern...
Factory pattern decouples object creation and allows creation by name using a common interface: class Animal{ public: virtual std::shared_ptr<Animal> clone() const = 0; virtual std::string getname() const = 0; }; class Bear: public Animal{ public: virtual std::shared_ptr...
The Builder Pattern decouples the creation of the object from the object itself. The main idea behind is that an object does not have to be responsible for its own creation. The correct and valid assembly of a complex object may be a complicated task in itself, so this task can be delegated to anoth...

Page 1 of 1