Works On My Machine(tm)
Oh, but it works on my machine! What gives?! Today, I found myself asking the uncaring monitor over and over again, while adding logs and going over existing ones, meditating over code while making sure I didn’t do any silly mistakes and overall being frustrated. It’s these kinds of head-scratchers that remind us why debugging is both an art and a science.
The Unseen CulpritPicture this: a seemingly innocuous orchestrator service, working perfectly in the local environment, suddenly throws a tan ...
Mocking HttpClient the simple way
Ever found yourself deep in unit tests, only to realize you need to mock an HttpClient? Yep, we’ve all been there. There are many ways of doing it, but which way is the best? Let me show you a straightforward yet flexible way to mock HttpClient. It’s simple, effective, and it’s going to make your life a whole lot easier.
So, let’s begin with implementing two helpers, which will be useful in setting up our mocks.
First, we create a custom HttpMessageHandler to intercept and handle HTTP requests i ...
'Production Ready' Non-Negotiable: Comprehensive Testing
Let’s delve into the most crucial, non-negotiable aspect of production-ready systems: Testing.
In my experience, opinions on testing vary widely, but unfortunately, some undervalue its importance or worse, take it for granted. I firmly believe that tests are indispensable; they act as a safety net, catching bugs before they can wreak havoc on a production system.It may sound cliché, but this analogy accurately reflects reality.So, let’s begin with some taxonomy. Testing realm is a big one, but b ...
'Production Ready' Non-Negotiable: Memory Dump Tooling
Local debugging? That’s easy. You’ve got your breakpoints, variable inspections, and on-the-fly state changes, provided you’ve got the right tools and know-how for your programming language.
But here’s a fun question: what if you hit a memory leak or a process crash a week into production? Even worse, in a complex system where recreating the issue is like finding a needle in a haystack. So, what do we do? Enter memory dumps.
What Are Memory Dumps?Think of a memory dump like a snapshot of your ap ...
'Production Ready' Non-Negotiable: Performance Metrics
Here’s a curious challenge I faced at Hibernating Rhinos, as part of the core team for the NoSQL database - RavenDB. We received a support ticket that was puzzling: why was a query, pulling roughly 100 results, taking several seconds to complete? This was odd, especially given the database’s modest size and the use of a local network.
Investigation Kicks OffThis conundrum landed on my desk. Fortunately, I was able to replicate the issue on my system. My first step? Checking the query’s performan ...
'Production Ready' Non-Negotiable: Structured Logging and Monitoring
Hey there! In the previous post of the series, we introduced the concept of production-ready software and mentioned that there are several non-negotiable elements that must be present in such a system.
So, let’s take a look at the first non-negotiable - the unsung heroes of any software system. Structured logging and Monitoring.
Oh, but we have logging; it’s just some text that we print when stuff happens. Why complicate things?, you might ask. And monitoring? Why would we need that? We have alr ...
Production-Ready Software: Introduction
In the tech world, the term ‘production-ready’ often gets tossed around, sometimes more like a hot potato than a clear standard. But what does it really mean? It seems like everyone has their own take, often shrouded in personal biases or cloaked in industry jargon.
In this post series, I will try to cut through the fluff and the corporate speak, because, let’s be honest, best practices do not have to be complex or hard to understand.
The Essence of Production-ReadinessBefore anything else, *pro ...
Taming Complexity with Responsibility
Imagine, one quiet morning, your boss comes to you and says, “Hey, our web shop is growing and we will be having more than one delivery provider now. Can you implement something that would select the best provider after a client pays for a delivery?”.After some back and forth about the criteria on how a delivery company should be selected - mostly by package size, weight and delivery company area, you set out to write the code. How hard can it be? Just write a few if statements, and that’s it, r ...
From Inheritance Hell to Component Heaven, the ECS Pattern
All you need is love and Object-Oriented, right? Right?Object-Oriented programming is one of the most widely used programming paradigms. It’s flexible, powerful, and has proven its worth over the years. However, as with any tool, there are situations where it might not be the best fit. In some cases, using an Object-Oriented approach can result in code that’s hard to maintain and overly complex.
Let’s say we’re developing a game and we want to add magic weapons. It should be trivial to create a ...
Disentangling the Spaghetti Monster
In this blog post, we will explore the practical application of a specific design pattern. To illustrate its usefulness, we will gradually reveal the problem in an “organic” manner, simulating how one might encounter such an issue in their daily programming tasks.
The What and WhyPicture this: you’re working on a music streaming platform, and you already implemented live and offline playback, search functionality, and user ratings. The last piece of the puzzle? Playlist suggestions based on user ...