Using No-Op Objects For Cleaner Code

Sooner or later every Go programmer will want to extract an object from another object such as Context or utilize an object that can be set to nil throughout the call stack. However, this can lead to ugly code that looks like: func someFunc(obj *MyObj) { if obj != nil { DoThis() } otherFunc(obj) } func otherFunc(obj *MyObj) { if obj != nil { DoThis() } ... } I this case, if our obj != nil, we want to [Read More]

Unbounded Queue: A tale of premature optimization

A simple start When you work in this industry for a while, if your introspective, you can discover what type of programmer you are. You might be a programmer obsessed with performance or trying to find clever tricks. I am neither of those. While I do like to find new techniques or simpler ways to do something, I generally prefer to steal from others who are much smarter than I. [Read More]

Abstraction of Storage APIs

Introduction One of the common problems in software development is dealing with storage. When writing micro-services you often are required to store application data in some type of long term storage (filesystem, NFS, SQL, Cloud storage by X vendor, ...). Instead of choosing a storage system and writing code to that storage system's API, it is often better to extract your use cases into a storage API and write concrete implementations [Read More]

Protocol buffers: Avoid these uses

Note: This is not an article saying protocol buffers are bad. Protocol buffers are a great serialization technology. Compact, easy to understand and readable/writable in several different languages. They easily beat JSON or other schema-less technologies when you know the structure you want to send/receive. But they aren't appropriate for every use case. Note: This article can be applied to multiple languages, but the code examples and talking [Read More]

Why I moved from Python to Go(Part II)

Note: This is a continuation of this article Type safety and the compiler to the rescue One of the first things we noticed using Go was that once a program compiled, it tended to work. This was not the experience that we had in Python. Small programs usually took a lot of runs before we got the bugs out. But Go usually just worked. Now of course, larger programs are [Read More]