Code that heavily relies on Task.Run tends to have issues. In my experience, this is a clear sign that the asynchronous model within the codebase is spotty at best. Indeed, a “really async” design would not generally rely on Task.Run…
Back to (GW-)basics
My foray into programming began with GW-BASIC on a Tandy 1000, an 8-bit IBM PC clone. In those days, one had only a few avenues of learning for coding knowledge: physical books and more experienced friends (who had probably read…
Humble controllers
Whenever I write code using ASP.NET Web API, I invariably make my controllers “humble.” I use this term in the same sense as described in the Humble Object pattern. Basically, a controller should be a thin coordinator between the client’s…
A real async GetFiles?
I’ve lamented in the past that there is no real async GetFiles. But that’s okay — we’re problem solvers! Perhaps if we could drop down to the core native API, we could fill in a gap like this. Let’s start…
Loopy tests
Loops are fundamental structures in almost every programming language (we’ll put aside APL for the time being). In unit tests, however, loops can be a problem. This is especially true of loops in the “Assert” section. For instance, consider this…
Async holes: StringContent
In a previous post, I introduced the concept of “async holes” — those unexpected gaps and obstacles when using asynchronous APIs in .NET. This time I will tell the tale of the async hole in StringContent. System.Net.Http.StringContent is the derived…
Async holes: ZipArchive
From time to time, I encounter unexpected gaps in asynchronous object models in .NET. I’ve taken to calling these “async holes” since they usually present an unpleasant obstacle in the clear path I try to follow while executing the TDD…
Refactoring C++: Extract Method using `friend struct This`
My day to day programming environment is C# + Visual Studio + ReSharper. I like to think I’m fairly productive in this setup and after years of experience have picked up a few fast and easy ways to refactor my…
Object Calisthenics and Advent of Code
A few weeks back, I became aware of Advent of Code, a site built by Eric Wastl. AoC is basically an annual 25 day programming challenge/competition which has run every December for the past three years. Since I had the…
Bring me the simulator, on the double!
The (oft-misunderstood) dependency inversion principle states that abstractions should not depend on details, and instead details should depend on abstractions. As an example, let us first consider a violation of this guideline: The so-called “abstraction” around configuration ConfigFile is very…