A Guide to Interfaces in Go

In Go, interfaces take the center stage. They are more flexible and more powerful than their counterparts in other languages. When coming to Go from another language, this may not be immediately obvious, yet this realization is quite important for our ability to write well-structured and decoupled code. Let’s explore exactly how flexible they are and how we can make the best use of them. Preamble I’ll assume that you have at least a passing familiarity with the Go programming language and interfaces. [Read More]

Learn Go by Building a Bus Service

Go is a pragmatic language. It’s about getting stuff done. This allows for a more direct coding style that I personally find to be a relief from the “classic” object-oriented coding styles with their proliferation of class hierarchies. With Go, we can still take advantage of many relevant design patterns without getting distracted by having to write getters, setters, factory classes and complex class hierarchies. Design patterns are fundamentally just recipes - or best practices - for how to approach certain classes of problems. [Read More]

How to Learn a New Programming Language

Want to pick up a new programming language? Great! I personally think that the landscape of programming languages has never been more exciting than it is now - there are a multitude of languages to pick from, and a true professional is polyglot (from Wikipedia: Polyglotism or polyglottism is knowledge of several languages, consisting of the ability to understand, speak, read, or write these languages). I won’t help you pick a language from the pile - that is entirely based on your coding level, language skills, ambitions and the direction that you’d like to take your career in. [Read More]

The Flyweight Pattern in Go

Definition: In computer programming, flyweight is a software design pattern. A flyweight is an object that minimizes memory usage by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. In the following, I’ll demonstrate the Flyweight Pattern with two examples in Go. First, I’ll optimize two memory-based caches that rely on the same underlying data, and then I’ll optimize another cache that contains repetitive data. [Read More]

Inheritance Is Indeed Evil

A tale of growing frustration with Object-Oriented Programming that highlights one of its core features as a culprit. It’s easy to become polarized about the two main paradigms that we use to classify new programming languages with. I certainly was, until recently. Do you prefer object-oriented programming, or functional programming? If you are okay with either paradigm, then congratulations — you are not polarized — but if you greatly prefer one over the other, or maybe you even glance condescendingly at fellow developers who don’t share your polarized view of the world, then I hope to change your mind. [Read More]

Reading Humongous Files in Go

A real-world performance comparison between Node.js and Go for file parsing unsurprisingly turns out in Go’s favor — but how much? This blog post was first published on Medium, available via CloudBoost. Part One Being fairly new to Go aka. Golang, I was itching to try it out on a real-world problem after having done numerous tutorials and CodeWars katas (don’t know CodeWars? Try it out, it’s really cool). At my workplace, my boss just so happened to find himself in a situation where he needed to parse a humongous XML file — a perfect opportunity to show off my new Golang skills! [Read More]