Ilija Eftimov
Thoughts on simple software engineering
Testing in Go
Archive
About
Suggest a topic
Posts
22
May 2020
Testing in Go: Stop Leaking Files
No test suite is perfect. Some test suites are missing good helper functions; others are under-configured or over-custo...
02
May 2020
Four Steps to Daemonize Your Go Programs
Hands-on introduction for the best four-step approach to daemonizing your Go programs
02
Apr 2020
Understanding bytes in Go by building a TCP protocol
Learn everything you need to know to work with bytes and slices of bytes ([]byte) by building a chat TCP-based protocol.
13
Mar 2020
Testing in Go: WebSockets
WebSockets offer duplex communication from a non-trusted source to a server that we own across a TCP socket connection....
02
Mar 2020
Testing in Go: HTTP Servers
Go's a great hammer for a lot of nails, one of the areas where I find it fitting is building HTTP servers. The `net/htt...
18
Feb 2020
Testing in Go: Clean Tests Using t.Cleanup
Go v1.14 ships with improvements across different aspects of the language. Two of them are brand new `t.Cleanup`, and `...
02
Feb 2020
Testing in Go: Golden Files
Hardcoding the expected values in an assertion is a straightforward approach in testing. Most of the time, we know the ...
05
Jan 2020
Make resilient Go net/http servers using timeouts, deadlines and context cancellation
When it comes to timeouts, there are two types of people: those who know how tricky they can be, and those who are yet ...
16
Dec 2019
Testing in Go: Test Doubles by Example
One of the biggest misconceptions is that doubles are a specific implementation of mocks or other testing constructs th...
01
Dec 2019
Testing in Go: Dependency Injection
In software engineering, over the years folks have developed many patterns, techniques and refactoring maneuvers. Some ...
16
Nov 2019
Simple Golang database seeding abstraction for Gorm
One of the most feature-full ORMs for Go that I have worked with is Gorm. If you would like to learn more about it, I r...
16
Sep 2019
Testing in Go: Fixtures
When I was researching the topic of test fixtures, I couldn't find much about their beginnings. My first search was abo...
27
Jul 2019
Testing in Go: Subtests
_Before we begin: The content in this article assumes knowledge of table-driven tests in Go. If you are unfamiliar with...
10
Jul 2019
Testing in Go: Table-Driven Tests
Coming from Ruby, which has excellent testing tools and libraries, the notion of table-driven tests was unusual for me....
01
Jul 2019
Testing in Go: go test
If you're going to remember anything from this article, remember this: `go test` is a command which automates the execu...
24
Jun 2019
Testing in Go: Naming Conventions
Programming languages and tools often have conventions. These conventions help make our work more straightforward. Just...
15
Jun 2019
Testing in Go: Writing Practical Failure Messages
All developers appreciate code that works, yet we spend much of our working hours debugging existing code. When fixing ...
30
May 2019
Testing in Go: Failing Tests
In the previous article on testing in Golang, titled [Testing in Go: First Principles](/testing-in-go-first-principles)...
08
May 2019
Testing in Go: First Principles
If you have any programming experience, whether that's as a student or a professional, there's a good chance you have h...
23
Apr 2019
Deep Dive in the Upcoming Go Error Inspection Changes
The team behind the language started working on a document titled ["Go 2 Draft Designs"](https://go.googlesource.com/pr...
01
Apr 2019
My First dotGo Conference
This year's dotGo in Paris was awesome. The people were great in general. The organisers and volunteers did a good job....
26
Mar 2019
Tell your team you are running late using Google Home, Google Cloud Functions, Golang and Twilio
In this age of cloud platforms, Internet of Things and SaaS products that are easy to integrate with, the effort of aut...
11
Mar 2019
Barebones model of Spotify's 'Recently Played' screen using a Least Recently Used (LRU) cache in Golang
One of the most used caching schemes is Least Recently Used (LRU). Caches that use this eviction strategy will remove t...
27
Feb 2019
When and Why to use a Least Frequently Used (LFU) cache with an implementation in Golang
Over the years, people involved in computer science and engineering have worked really hard on optimisations of various...
13
Feb 2019
Golang Datastructures: Trees
You can spend quite a bit of your programming career without working with trees, or just by simply avoiding them if you...
26
Jan 2019
OTP in Elixir: Learn GenServer by Building Your Own URL Shortener
Looking at any programming language you will (hopefully!) find a rich and useful standard library. I started my professi...
15
Jan 2019
Understanding the basics of Elixir's concurrency model
If you come from an object-oriented background, you might have tried concurrency in your favourite OO language before. ...
31
Dec 2018
A deeper dive in Elixir's Plug
Being new to Elixir and Phoenix, I spend quite some time in the projects' documentation. One thing that stood out for m...
23
Dec 2018
Validate your passwords using Elixir and haveibeenpwned.com's API
Unless you've been living under a rock for the last couple of years, you probably know what two-factor authentication (...
24
Feb 2018
Data structures in Go: Stacks and queues
In a previous post[^1], we took a look at linked lists and how we can apply them in a hypothetical use-case. In this po...
18
Feb 2018
Data structures in Go: Linked lists
Data structures and algorithms are the bread and butter of computer science. Although sometimes they appear scary to pe...
30
Jan 2018
Create and manage MacOS LaunchAgents using Go
If you have ever tried writing a daemon for MacOS you have met with `launchd`. For those that don't have the experience...
23
Jan 2018
Packing multiple binaries in a Golang package
Recently, while writing a small Golang program for setting reminders I came across a small confusion that I guess most ...
02
Nov 2017
Understanding why and how to add idempotent requests to your APIs
Idempotency is an often used term in computer science. It's meaning to some might not be known, to others it's very wel...
07
Oct 2017
Versioning REST APIs: The Theory and Using Grape in Ruby
Nowadays, having an API on top of your application is considered common. I've often been disapointed when I've been ex...
29
Oct 2016
What happens when you DELETE a resource?
Have you ever found yourself publishing an API, either an internal or a public one? Have your ever heard from the consu...
26
Jun 2016
Sprinkle some HATEOAS on your Rails APIs
REST as a concept was introduced by [Roy Fielding](https://en.wikipedia.org/wiki/Roy_Fielding) in his doctoral thesis, ...
16
Jun 2016
The practicality of designing and describing your APIs
The web, as we all know, is driven by APIs. Since the rise of mobile applications and the JavaScript driven single-page...
06
Jun 2016
Learn your tools: Navigating your Git History
Starting a greenfield application everyday is nearly impossible, especially in your daily job. In fact, most of us are ...
27
May 2016
How Rails handles status codes
Recently, I have been building an API as part of my day job. Rails is a great framework to build APIs in, and it has be...
20
May 2016
A bit about decorators and presenters
Object-oriented programming and design is (or, was?) a revolutionary way of thinking and designing programs. It introdu...
23
Apr 2016
Git history is underrated
Most of us use Git on a daily basis. We have all read a book (or part of a book) about Git, we learned how to do commit...
31
Mar 2016
Write your first Rubygems plugin
I don't think that at this point Rubygems needs any introduction. Except if you have been living under a rock for the l...
25
Mar 2016
You Can't Rescue Them All
Imagine you just woke up, took a shower and you immediately go to your coffee machine to make that strong, large, morni...
08
Mar 2016
Refactoring in Ruby: Primitive Obsession
We've all been at this point where we have bloated our classes with primitive values all over the place. Usually, we dr...
23
Feb 2016
PostgreSQL Indexes: B-Tree
Indexes in relational databases are a very imporatant feature, that reduce the cost of our lookup queries. In the last ...
30
Jan 2016
PostgreSQL Indexes: First Principles
We have all heard about indexes. Yeah, that thing that it's automatically added to the Primary Key column that enables ...
24
Jan 2016
Building a Weather Widget using RxJS
Reactive Programming is a very interesting programming paradigm that I started pondering with last week, which ended up...
19
Jan 2016
Understanding Reactive Programming with RxRuby
Reactive Programming is a relatively new and interesting programming paradigm that has picked up quite a bit of popular...
13
Jan 2016
Refactoring in Ruby: The right place for a Builder?
Recently I started tackling refactoring in Ruby with my blog posts. It seems that it's one of the most popular topics t...
07
Jan 2016
Running a Rails Application on Deis
In the last couple of years, we have seen a lot of development in the devops field. It’s becoming much easier for devel...
04
Jan 2016
Refactoring in Ruby: Smelly Parameters Lists
Ruby is a really clear and expressive language, but we developers sure know how to make a mess. Even when you think you...
28
Dec 2015
Refactoring in Ruby: TDD your way through Extract Class
There are a lot of refactoring patterns available out there for us. I assume that most of us use these patterns, at cer...
14
Dec 2015
Rails, Secure Cookies, HSTS and friends
Ruby on Rails as a framework does a lot of things for us developers. We get a very customizable middleware stack, great...
03
Dec 2015
Why and how to test Rake tasks in your Rails application
Most of us write some Rake tasks and completely forget about them. In fact, we rarely give any love to our Rake tasks. ...
27
Nov 2015
Writing command line apps with Elixir
Elixir is a really cool language. Although I do not have much experience with it (yet), I am always trying to build int...
26
Nov 2015
Getting Started with Minitest
Learn how to integrate Minitest into your Ruby project and reap the benefits of test-driven development. Read the arti...
04
Nov 2015
Testing Ruby Mixins with Minitest in isolation
Mixins in Ruby are a very powerful feature. But knowing how to test them sometimes is not so obvious, especially to beg...
23
Oct 2015
Filter request params from Phoenix logs
Phoenix is a really powerful and customizable framework. One of it's small but important configurations is filtering cu...
18
Oct 2015
How to set tests as pending in your ExUnit suite
Elixir's built in testing library is called ExUnit. It's a proper testing framework, which, although simple, gives the ...
09
Oct 2015
Write and publish your first Elixir library
As some of you have heard lately, [Elixir](http://elixir-lang.org) is the new hotness. Is it just hype? Well, I though...
21
Aug 2015
Variable hoisting in Ruby
Have you ever heard of hoisting? Well, regardless if you have or you have not, Ruby has an interesting hositing mechani...
15
Aug 2015
TDD Patterns: Humble Object
We all know that there are different design patterns. They are all quite trivial to learn, but, the trick lies in apply...
05
Aug 2015
Test Doubles: in theory, in Minitest and in RSpec
Those of us that do **T**est **D**riven **D**evelopment have heard about doubles, mocks, stubs, fakes and spies multipl...
29
Jul 2015
Exception handling and testing it with Minitest
When testing our code, we usually go for the happy path (TM). We are awesome developers, we test our code, we are caref...
21
Jul 2015
Testing Ruby's floats precision
Float precision in Ruby is a well known quirk. But when testing floats, not many of us bother to remember this and make...
14
Jul 2015
Migrating a test suite from RSpec to Minitest
I have always wanted to have some fun with [Minitest](https://github.com/seattlerb/minitest) but until this weekend I n...
07
Jul 2015
How to write Rails middleware
In my last two posts about Rack, I wrote about [the basics of Rack](/rack-first-principles) and [how to write middlewar...
01
Jul 2015
Test-Driven Thinking
There has always been a lot of noise about Test-Driven Development (TDD), best practices and it's pros and cons. I don'...
28
Jun 2015
Rack: Writing middleware
Last time I wrote about [the basics of Rack](/rack-first-principles) and writing a tiny Rack application. If you are un...
16
Jun 2015
Rack: First Principles
About three years ago, when I started working with Ruby and Rails, I noticed that the term "Rack" always came up in my ...
12
Jun 2015
In and out of PostgreSQL using COPY
I am pretty sure everyone of us has been in a situation where you needed to generate a report and/or extract some data ...
26
May 2015
Implementing "the lovely" Singleton Pattern
In every software, there are some things that have to be unique. For example, a Rails app has only one logger. Also, ap...
19
May 2015
POV: Startup Weekend Skopje
Startup - in my opinion it's the most ear-catching word nowadays. It represents growth, energy and, of course, billions...
18
May 2015
How to: YourGem.configure
Really cool gems, like Carrierwave for example, have this neat feature of configuring the gem in runtime. It allows you...
04
May 2015
RailsConf 2015 talks that you should watch
Recently Confreaks uploaded a ton of RailsConf 2015 talks on Youtube. Although I haven't watched all of the talks, thes...
28
Apr 2015
How to write RSpec formatters from scratch
Recently I did an experiment with RSpec's formatters. Turns out, the output that RSpec returns when you run your specs ...
22
Apr 2015
Pattern to pattern: Template Method & Strategy
Recently I wrote about the [Template Method pattern](/template-method-pattern-in-ruby/) and how it's implemented in Rub...
15
Apr 2015
Exploring new methods in Ruby 2.2.0
For those late to the Ruby 2.2.0 party like me, aside from the changes (and updates) the core team made under the hood ...
14
Apr 2015
Using multiple sources in a Gemfile
Gemfiles require at least one gem source, in the form of the URL for a RubyGems server. Although it's not recommended, ...
06
Apr 2015
Template Method Pattern in Ruby
When working as a software developer, knowledge of some design patterns is always welcomed. If you've never heard about...
01
Mar 2015
AngularJS Services Part 4: Value and Constant
So far we saw the magic of creating AngularJS services using [Provider](/angularjs-services-part-1), [Factory](/angular...
28
Feb 2015
AngularJS Services Part 3: Service
So, Service is basically the same as Factory, it just has one key difference. Service treats the function as a construc...
27
Feb 2015
AngularJS Services Part 2: Factory
If you don't know the basics of AngularJS service, I recommend you read the other article I wrote on [AngularJS Service...
25
Feb 2015
AngularJS Services Part 1: Provider
I started using AngularJS couple of months ago, when [we](http://siyelo.com#team) got a new client that wanted us to he...
05
Jun 2014
SOLID Principles in Ruby
Regardless of your knowledge level, as a programmer you love to write awesome code. It's what we do. We like it and we ...