Writing Good Unit Tests: A Step By Step Tutorial

A tutorial to help you write comprehensive unit test suites.

Let’s imagine we just wrote a method calculating distance between two points on our planet. And let’s imagine we want to test it as well as possible. How do we come up with test cases? And what exactly do we need to test?

Bonus: learn a surprising fact about the Fiji islands. 🇫🇯

Continue reading “Writing Good Unit Tests: A Step By Step Tutorial”

Code Reviews Are Awesome, Here Are 7 Reasons Why

Code reviews are a great practice to apply in software development. The approach is very simple: when you’re done with your code, give it to someone else to look at and leave comments.

Despite of its simplicity, it brings considerable advantages. Here are 7 reasons why this practice is useful.

Continue reading “Code Reviews Are Awesome, Here Are 7 Reasons Why”

Unit testing: best practices

I have been unit testing my code for many years.

While building a GIS-system, we really cared about our product quality. Our users’ needs demanded the app to work properly. I had all critical and/or complex parts of code 100% test-covered, with multiple paths and corner cases. It was such a pleasure to find a bug, fix it, write a couple of tests for this surprise scenario, and be sure it won’t break again. Ah, good times.

Continue reading “Unit testing: best practices”

Little Geo Stories: Square Miles

How I sensed a bug while not seeing any, and what came of it.

Dear reader,

Today I found a place on our website where we display the size of a recreational area in square kilometers.

199 km²

I cannot fully explain what happened next, but I had a hunch something must be wrong with this feature.

Narrator: there was.

Continue reading “Little Geo Stories: Square Miles”

Modularization and dependency management: three steps to better code

If you ask me, what’s a single most important thing in writing good code, I’d reply: “Modularization and Dependency Management”.

Well, actually, that’s two things. Sorry about that! But they are two sides of the same coin, and you can’t have one without the other, if you want to your code to be nice and clean.

Continue reading “Modularization and dependency management: three steps to better code”

Prioritization for Perfectionists, or: How I Learned to Stop Worrying and Love the Non-Perfection

Are you a perfectionist? That kind of a person that can never say “I’m done”, “it’s ready” or “let’s ship it”? The one who can’t release the new feature unless it’s polished and perfect?

Continue reading “Prioritization for Perfectionists, or: How I Learned to Stop Worrying and Love the Non-Perfection”

Design your code for readability

So, how do you usually code?

You have a task: add this thing to that place. First thing you do – you find where “that place” is and how to get “this thing”. To do it, you read the code.
Reading happens every time you need to do something, doesn’t it? If something doesn’t work, or you need to optimize it, or add one more tiny thing, you search for the place in the code and read it again. And again.