Don’t Repeat Yourself is a good maxim in software design — avoid duplication of information. Today’s sample code will show a small fix to a problem which quite literally involves repeating yourself: those annoying “call twice” Win32 functions like GetVirtualDiskPhysicalPath.…
Design for disaster: the small stuff
Is your system designed with disaster recovery in mind? There are obvious things like taking backups of state (and maybe validating them, too) and configuring geo-replication to mitigate the effects of regional outages. But what about the more subtle aspects…
The testable adapter anti-pattern
Let’s say you’re writing a module to deal with Windows optional features. Following the guidance of the Ports/Adapters/Simulators design approach, you come up with a port IFeatures and an adapter WindowsFeatures. “I must make my adapter testable!” you exclaim, and…
The crumbling bridge to innovation
Technical debt is well-trodden ground in modern discussions of design and development. So-called “software rot” can damage team productivity and make every bug fix and feature addition all the more painful. Less often mentioned are the consequences of the same
Dictionary and memory usage
Consider this code using Dictionary<TKey, TValue>: One might assume that the capacity (actually bucket count in this case) and memory usage will stabilize after repeatedly filling then clearing the collection. Unfortunately, this is not the case. Here is the output…
Easier to test => better
Rick Mugridge presented a paper “Test Driven Development and the Scientific Method” at the 2003 Agile Development Conference. There he speaks of theory simplicity and draws a parallel between Occam’s razor and the (positive) pressure of TDD to “choose the…
Automatic vs. automated
Modern software systems involve plenty of automation, especially in testing, deployment, and operations. However, there is a world of difference between automatic and automated processes. Automation can be an insidious half measure which creates the illusion of agility while actually…
Worst practices: exceptions
There are no best practices. But there are some pretty bad ones when it comes to exceptions. Hans-Eric Grönlund wrote about some of them and I agree with his list. Here are a few more: Breaking the contract Languages like…
Wake up again (and again)!
Previously, I wrote about a simple way to change slow, time-sensitive tests into fast, no-wait tests using some async tricks. However, the example shown only works well when the underlying slowness involves a one-shot action. What if instead you are…
SSD and … sync I/O?
Walter Bright (via Andrei Alexandrescu) says, “Measuring gives you a leg up on experts who are too good to measure.” Today I’ll present some measurements that might be a bit surprising. In the old days of mechanical spinning disks, the…