Go
In programming, interfaces are a powerful concept that lets us express our code more abstractly. Interfaces allow us to reason about the higher-level logic of our processes without getting down to the small details. Go has arguably one of the best interface implementations. With great features like implicit implementations, assertion, and more.
Interfaces must be used cautiously since they introduce more abstraction to our code, making it susceptible to unnecessary wrappers, misuse of definitions, and sometimes, even memory issues. In this article, I will discuss cases where interfaces can positively impact your code. But first, let’s talk about what an interface is not.
Disclaimer: Go is not a pure functional programming language. This article does not try to teach you functional programming in Go since imposing functional programming concepts, may result in unnecessarily awkward code. Go has its style, and it’s proven to be highly successful. Therefore, there’s no point in forcing a foreign dialect on Go code. Haskell would be a great choice if you want to express yourself functionally.
This article aims to provide imperative programmers a bridge to the functional world. Crossing that bridge and seeing the other side can help us reimagine problem-solving and add new skills to our set. We will encounter Go translations to some original Haskell code, hoping this will allow us to understand the original dialect.
Profiling is an underrated skill among software-engineers and it’s often overlooked by even very skilled developers. Profiling a program, is essentially measuring CPU and memory usage to spot bottlenecks, memory leaks, and other performance issues. Knowing how profile a program and interpret the result can direct us to where exactly our program is suffering from poor performance, and focus our efforts on optimizing those specific parts. In this article, we’ll be profiling a real-world Go program. We’ll learn how to interpret the results, draw conclusions, and optimize the program accordingly.
This article is a followup for a more basic guide. If you would like to read the previous article, click here
If you would like to skip to a more advanced article, check out Synchronization Patterns in Go
Caching is one of those things that almost every digital service uses in some way or another, it can improve user experience, and reduce costs by preventing redundant computation. When incorrectly applied, it can be the root cause of many nasty issues such as serving stale data, creating security breaches, and eating up the memory. In this article, we will see what cache exactly is, what types of cache we can implement, and how to implement them correctly.