About Single Responsibility Principle

Single Responsibility Principle (SRP) is the first one of the 5 famous principles that make up SOLID, a classic guideline to write clean and maintainable code, worshipped by a plethora of programmers worldwide. There exists various articles and workshops out there to explain the principle. Tech celebs support it, talk about it in social platforms. Many articles, however, does a poor job explaining the principle, resulting in a shallow and rigid understanding of the principle among developers....

April 6, 2023 · 5 min

Graceful Http Server Shutdown Experiment

In our previous article, we implemented a server in Golang that gracefully reacts to termination signals. We presented the problems of the hello world version of the server, how to address it, but did not perform any verification. In this article, we’ll prepare an experiment on both the graceful server, and also the not-so-graceful one to contrast their behavior. The experiment is done in a macOS environment, but the same process will work in Windows and Linux....

February 13, 2023 · 5 min

Git Bisect to the Rescue!

Last week I had an interesting experience at work. An application that my team has been working on showed a weird bug with the latest build. It was very difficult to locate the source of the bug, and there were a plethora of commits between the last working build and the latest one (it’s actually terrible to let this happen, but terrible things happen all the time anyway). Finding the offending commit in this case could shrink the area that we need to look at....

December 24, 2022 · 6 min

Writing Concurrent Tests In Golang

Golang provides excellent concurrency mechanism, including some built-in functionalities to run tests faster. In this blog post we’ll explore some useful techniques in running concurrent tests in Go. However, we will not cover basic knowledge of Golang syntax, concepts and how to write tests in Golang in this post. Basic tests Imagine we want to implement some helper functions for the slice data type. package slices // Unique returns true if slice does not contain any duplicates....

December 12, 2022 · 8 min

Graceful HTTP Server Shutdown In Golang

Golang is a fantastic programming language with so many features supported out of the box. One such feature is a full-fledged HTTP server, which requires only a few lines of code to start. However, not many people are aware of the mechanism to gracefully shut down the server. In fact even Golang's official HTTP server tutorial does not mention this important feature. In this blog post we’ll explore a problem with the hello world version of the HTTP server in Golang, and how graceful shutdown addresses it....

November 9, 2022 · 8 min

About DRY

DRY, which stands for Don’t Repeat Yourself, is a well-known programming principle. Many developers, however, misunderstand the principle, possessing a false grasp of what DRY is really about. In this blog post we’ll investigate a case in which DRY is misunderstood and applied in the wrong manner, and its consequences. A hypothetical code base written in Golang will be used to demonstrate the idea, but the syntax should be easy enough to understand even without Golang knowledge....

November 5, 2022 · 12 min

Useful Goland Shortcuts

As a developer who writes Golang everyday, high productivity is of utmost importance. Intellij Goland IDE provides so many useful features to reach this goal: from viewing the current staged changes to running a debugging session. After working with it for a few years I believe that Goland is an essential part of my work, and I’m willing to pay for the annual license even if my company does not. More than just a text editor, Goland provides a bunch of helpful shortcuts to help us execute trivial tasks quickly....

October 30, 2022 · 5 min

Signed Commit With SSH Keys

A commit can be signed locally before pushing to remote to ensure its authenticity. Why do we need that? Doesn’t the commit itself contain the author’s name and email? Well it turns out that it's possible to change the author's name and email of a commit. A signed commit, on the other hand, can ensure that the commit was originally made by the author who signed it using an SSH, or GPG, or S/MIME key....

October 14, 2022 · 4 min

Hello World Part 3: Custom Domain

In the previous post, we successfully pushed our source code to Github, and leveraged Github Pages to host our blog. We also explored Github action to set up an automatic build pipeline for our blog. In this tutorial we will learn how to deploy our blog using our own domain while still leveraging all of the tools Github provides. Domain purchase There are many services from which you could buy a domain....

July 23, 2022 · 3 min

Hello World Part 2: Leveraging Github Pages

We successfully created a blog in our local environment in the first part of this tutorial. Now it’s time to share it with the Internet. We will levarage Github pages as our hosting environment. Why? Because it’s free! Github Setup I’m gonna assume that you already got a Github account, and also installed git in your local machine. You should create a new repository in your Github, name it personal-blog, or any fancy name that you want....

July 19, 2022 · 3 min