-
Refactoring Safely With Tests

I’ve recently been working on adding a new feature that, for many reasons, requires a great deal of refactoring to our existing codebase. I’ve done code refactoring for most of my career, and I’ll do it many more times until the day I retire. When I started, though, things were a bit different from what…
-
Staying Useful In The AI Era

Last weekend, I was talking with a friend about the usage of Generative AI by some of her university students. She was concerned about the impact of these tools on their writing skills, as they are missing key years of practice that will help them develop this skill. Although I can understand her, I can…
-
The Risk Of Assuming

Life sometimes teaches us lessons that we can apply in the workplace. During my last years of university, I learnt that assuming can have serious consequences. This is the story. As part of my master’s thesis, I needed to take detailed measurements of the environment to make 3D computer models. For this, I used a…
-
The Singleton Design Pattern

The Singleton Design Pattern as we know it today was made popular by the book Design Patterns, written by the famous Gang of Four and published in 1994. This pattern shows us how to create a Singleton class. A Singleton ensures there is exactly one object of that class. We cannot directly create new instances,…
-
Operator Precedence Anxiety

Early in my career, I used to add useless brackets to my logical expressions “just in case”, meaning that I wasn’t really sure about the precedence of operators, and it was easier to just add some parentheses than be bothered to learn what operator was evaluated first. After a while I learnt to do better…
-
Good comments

Although the desire for good code is as old as code itself, it was Robert C. Martin’s Clean Code book from 2008 that made this name popular. His book compiles many good practices and recommendations that have been conceived and put to the test for many years, and it is considered by many, me included,…
-
The Big O Confusion

It is sometimes hard to notice, but many of the foundations of computer science and programming come from mathematics and their many branches. One example of that is the famous Big O notation, a technique so useful to evaluate an algorithm’s time and space complexity that nowadays it is part of most job interviews. The…
-
Commit As A Team

A couple of years ago I was working on a very challenging and interesting project, which had many features competing to go live. We had a line of internal customers ready to use our product as soon as we added the features they needed, and everything was working fine as we had a clear roadmap…
-
Intro to UML

The traditional saying goes “An image is worth a thousand words”, and I strongly believe this applies to diagrams as well. It doesn’t matter how many words we spend trying to explain the nuances of a system: sometimes we just need a simple diagram to put all the pieces together. For many decades, there were…
-
Inverting Logical Expressions

Part of our day-to-day tasks is to do code refactoring. As part of this process, I’m sure that many of us have had to negate the logical expressions in if or while statements at least once. For example, we may want to change this code: into something like this: This is indeed a very simple…
