Top 8 Benefits of Functional Programming

calculus on a chalkboard

Functional programming is a way to writing code where programs are created strictly through functions. Functional programming has gained quite a bit of traction in recent years among the development community, mostly because of the benefits it provides. Functional programming is a declarative way to write provably correct code. Function definitions are expressions that simply map inputs to outputs, rather than a … Read more

The Pros and Cons of DRY Code

desert landscape

Clean code is like clean garbage – it’s only clean if it doesn’t exist. In other words, the only clean code is no code. Let’s start with an acknowledgment that a perfectly clean (empty) codebase is useless. With that in mind, our pursuit of clean code will necessarily consist of tradeoffs. We’ll trade usefulness for … Read more

Writing Good Unit Tests; Don’t Mock Database Connections

Writing Good Unit Tests; Don't Use Database Mocking

Unit tests are unbelievably important to us as developers because they allow us to demonstrate the correctness of the code we’ve written. More importantly, unit tests allow us to make updates to our code base with the confidence that we haven’t broken anything. In our eagerness to get 100% code coverage, however, we often write … Read more

The Nuances of Constants in Go; Go Isn’t JavaScript

The Nuances of Constants in Go; Go Isn't JavaScript

Constants can be confusing and easy to misuse in Go if you are coming from an untyped language. Let’s take a look at some of the nuanced details of how they work in Go. It’s probably unsurprising, but Go’s constants are almost nothing like JavaScript’s bastardized version of the concept. Go vs JavaScript Many programming … Read more

Practical Patterns for Technical Writing

Practical Patterns for Techincal Writing

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 has become a more important part of my job, so I put … Read more

How to Make Pure Functions (Go)

Pure Functions in Go

Pure functions are often hyped up in the JavaScript world, probably because of the abundance of stateful front end applications. While pure functions have their downsides (i.e. inconvenience, potentially large argument lists), they should be used as much as reasonably possible. We’ve made a lot of changes in the Qvault app codebase recently to use … Read more

Guard Clauses – How to Clean up Conditionals

Guard Clauses - How to Clean up Conditionals

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

Should You Return Empty or Nil Slices in Go?

Empty vs Nil Slices in Go

In Go, we often need to return 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 maps and … Read more

Slow Is Smooth, Smooth Is Fast – 25% of Our Time Refactoring

Slow Is Smooth, Smooth Is Fast - Refactoring

My team at Qvault 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 … Read more