Mon, Feb 22, 2016
Introduction The Adapter Pattern is responsible for adaptation of two incompatible interfaces. It is a structural pattern that is responsible to join functionalities of independent or incompatible interfaces without modifing their implementation.
Interfaces may be incompatible but the inner functionality should suit the need. It allows otherwise incompatible objects to work together by converting the interface of each struct into an interface expected by the clients.
Purpose Impedance match an old component to a new system Wrap the interface of a object into another interface clients expect.
Sat, Feb 6, 2016
Preface The Prototype Pattern creates duplicate objects while keeping performance in mind. It’s a part of the creational patterns and provides one of the best ways to create an object.
In the mainstream languages (like C# and JAVA), it requires implementing a prototype interface which tells to create a clone of the current object. It is used when creation of object directly is costly.
For instance, an object is to be created after a costly database operation.
Wed, Feb 3, 2016
Recently I started a series of articles about Gang of Four Design Patterns and their adoption in Golang. They made a lot of noise in the community. I read a lot of contradictionary opionions whether should be used or not. I am publishing those articles as show case how the common design patterns can be adopted and implemented in Golang. I don’t encourage or promote their usage. Every developer has own style of programming, architecture desing and problem solving solutions.
Sun, Jan 31, 2016
Introduction The Factory Method pattern is a design pattern used to define a runtime interface for creating an object. It’s called a factory because it creates various types of objects without necessarily knowing what kind of object it creates or how to create it.
Purpose Allows the sub-classes to choose the type of objects to create at runtime It provides a simple way of extending the family of objects with minor changes in application code.
Sun, Jan 24, 2016
Introduction The Builder Pattern is a creational design pattern that’s used to encapsulate the construction logic for an object. It is often used when the construction process of an object is complex. The patterns is well suited for constructing different representations of the same class.
Purpose Separate the construction of a complex object from its representation so that the same construction process can create different representations. A common software creational design pattern that’s used to encapsulate the construction logic for an object.