Writing technical documents like API or architectural documentation which exceeds a simple flow diagram can be a daunting task. If you have some experience with technical documents, you will probably agree that there is nothing more frustrating than bad documentation. Lately, technical writing became a more important part of my job, so I put together … Read more Practical Patterns for Technical Writing
One of the first concepts new developers learn is the if/else statement. If/else statements are the most common way to execute conditional logic. However, complex and nested if/else statements can quickly become a cognitive burden and compromise the readability of a program. Guard Clauses Guard Clauses leverage the ability to return early from a function … Read more Guard Clauses – How to Clean up Conditionals
In Go, we are often returning zero values. Idiomatic Go encourages the use of guard clauses, and guard clauses necessitate the need to return early. When returning early with an error, by convention all other return values should be zero values. The confusion arises with data types like maps and slices… should they be nil, … Read more Should You Return Empty or Nil Slices in Go?
My team has been spending less of our “free” time working on bugs and features from the backlog, and more time refactoring our codebases and test suites. As a result, and perhaps somewhat counterintuitively, we’ve noticed a significant increase in our throughput of features and bug fixes. As it turns out, its easy to find … Read more Slow Is Smooth, Smooth Is Fast – 25% of Our Time Refactoring
There are quite a few ways to create new maps and slices in Go. Which one is best? Or perhaps better asked, which one is best in your situation? Let’s take a look. Slices var varStyle string is the idiomatic way to declare an empty slice. The slice is actually nil, which means it will … Read more Make, New and Literals Cheat Sheet – Slice and Map Initialization in Go
Sorting is a common task in programming, and for that reason most languages have a default sorting algorithm in their standard library. Go is one such language. Go has gone about providing sort functionality in one of the most elegant ways possible, via an interface. Any type that satisfies this interface can be sorted using … Read more Sorting in Go – Don’t Reinvent This Wheel
Go is strongly typed, and with that, we get many options for simple variable types like integers and floats. The problem arises when we have a uint16, and the function we are trying to pass it into takes an int. We find code riddled with int(myUint16) that can become slow and annoying to read. Go’s … Read more Don’t Go To Casting Hell; Use Default Native Types in Go