From Legacy Code to Testable Code #7 – Introduce Parameter

Today we’re going to talk about the Introduce Parameter refactoring pattern. This is one of the more useful patterns to clear code from dependencies. Here’s a method we’d like to test: public int Calculate(int x, int y) { if (OperationManager.ShouldAdd()) return x+y; else return x-y; } As we can see, there’s a nasty dependency right there in the middle. Since in this ...

Read More »

Optimizing I/O throughput

We got a customer request about performance issues they were seeing on startup on a particular set of machines. Those machine run in a cloud environment, and they have… peculiar, one might say deviant, I/O characteristics. In particular, the I/O pipeline on those machines is wide, but very slow. What do I mean by that? I meant that any particular ...

Read More »

Matching string prefixes using a prefix-trie 2

After discussion the general problem of matching string prefixes two weeks ago, we starting on the implementation of a prefix-trie to solve the problem efficiently last week. Our implementation so far is able to quickly construct a prefix-trie from a list of strings. What is still missing is any kind of functionality to query the data structure for information. Today ...

Read More »

WCF Proxies – From beginner to expert

Windows Communication Foundation is a great framework for building highly secure and reliable services that can integrate across different platforms. One of its great features is that it provides SOAP tooling for automatically creating proxy classes-clients to consume the services. When I say tooling I mean the well known Add Service Reference.. option or the Web Services Description Language Tool ...

Read More »

The Ugly Truth about Emergent Design

If the 2nd D in TDD is design, then we’re talking about emergent design. The tests drive the design, which emerges from thin air, and step by step reveals itself in all its glory. Emergent design has got to be superior to upfront design, right? Well, it depends. If we’re doing a design up-front, we need to take into account ...

Read More »

Load testing using Azure

So everyone wants to have the ultimate system that never breaks can handle ‘all’ the users and shows no strain when doing so. How do you accomplish something like this? Well you could hire developers that know all the best ways to do everything, experts in everything related to configuring applications to run the best that they can on the ...

Read More »

Matching string prefixes using a prefix-trie

Last week we discussed the problem of matching string prefixes and designed algorithms on the basis of a sorted list of strings. Our solutions had good runtimes given the constraint, however we can do much better by using a specialised data structure instead. The data structure in question is a trie, also called radix tree or prefix tree. Today we ...

Read More »

What is a Microservice?

Abstract In this article, excerpted from my upcoming book Microservices in .NET, I will talk about the characteristics that help you recognize a Microservice when you see one and that help you scope and implement your services in way that enable the benefits of Microservices A Microservice is a service with one and only one very narrowly focused capability. That ...

Read More »

Creating a Unit Testing Strategy – Part V

This is the 5th and final part of the series about analyzing what we’re coding, and therefore what to test. Last time, we actually got to writing the tests. Let’s do some cleanup. Step 8: Review Once we have the tests, it’s time to review both the code and tests. But we do those on a couple of levels. At the ...

Read More »

jq error – Cannot iterate over null (null)

I’ve been playing around with the jq library again over the past couple of days to convert the JSON from the Stack Overflow API into CSV and found myself needing to deal with an optional field. I’ve downloaded 100 or so questions and stored them as an array in a JSON array like so: $ head -n 100 so.json [ ...

Read More »