Watchdogs have been longtime staples of the embedded systems space. But they are also quite useful for distributed services where it is advantageous to attempt automatic recovery from transient errors. When it comes to watchdog implementations, the stakes are understandably…
Async in the wild: WCF
WCF (client) is open source. An interesting side effect of this development is the opportunity for async enthusiasts to pore over some production-ready async code. Since WCF was released even before .NET 3.5, it has several clever patterns for sensibly…
Destroy all* tests: unit test edition
Sometimes the code we need to write is so simple that we cannot imagine getting it wrong. Going test-first in these cases just seems apt to lead to tedium and tautologies. This could be a fair point if the sole…
Destroy all* tests
Tests have a shelf life. Boris Beizer famously wrote about the pesticide paradox a few decades ago: Yesterday’s elegant, revealing, effective test suite will wear out because programmers and designers, given feedback on their bugs, do modify their programming habits…
Useful proxies
The proxy design pattern is widely used in remote communication scenarios, e.g. DCOM or WCF. But it has just as many uses closer to home. For example, perhaps you need the ability to read and write files in a directory,…
Blogging on logging
Everyone loves a log. A trace log can provide insight into the goings-on of a running system. An audit log gives you an important “paper trail” tracking who did what and when. An error log might be an important aid…
One box to rule them all?
If your distributed system supports some form of scale minimization, you may feel a temptation to solve a variety of semi-related problems with the same “one box.” It’s more efficient to reuse code, after all. Unfortunately, it is also easy…
Orchestrating race conditions
Many a programmer has struggled with unit tests and those pesky race conditions that are seemingly immune to them. Is it even possible to verify concurrency correctness using TDD? I am going to tell you that it is — sometimes.…
Laziness is a virtue
Sometimes you want lazy initialization but your initialization function is asynchronous. Stephen Toub wrote about this conundrum years ago on the pfxteam blog. The solution as he describes it is fairly straightforward — use Lazy<T> combined with Task<T> and you’re…
Scale minimization
Long ago, I wrote about high-level testing and alluded to scale minimization as a useful technique in doing so. In this post, I’ll explore this idea a bit more. What is scale minimization? You may have heard it referred to…