Design Patterns in Golang: The Good, the Bad and the Ugly

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....

February 3, 2016 · 4 min · Svetlin Ralchev

Desing Patterns in Golang: Factory Method

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....

January 31, 2016 · 4 min · Svetlin Ralchev

Desing Patterns in Golang: Builder

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....

January 24, 2016 · 4 min · Svetlin Ralchev

Design Patterns in Golang: Singleton

Introduction Sometimes it’s important to have only one instance of an struct. This is useful when exactly one object is needed to coordinate actions across the system. Singletons provide a global point of access to themselves. The singleton pattern is one of the simplest design patterns. It requires only one type which is responsible to instantiate itself, to make sure it creates not more than one instance. The same instance can be used from everywhere....

January 17, 2016 · 3 min · Svetlin Ralchev

Serialization objects with protocol buffers in Golang

What is protocol buffers? Protocol Buffers is a method of serializing structured data. It is useful in developing programs to communicate with each other over a wire or for storing data. The method involves an interface description language that describes the structure of some data and a program that generates source code from that description for generating or parsing a stream of bytes that represents the structured data. Google developed Protocol Buffers for use internally and has made protocol compilers for C++, Java and Python available to the public under a free software, open source license....

January 12, 2016 · 5 min · Svetlin Ralchev