Testing DI bootstrappers

While your Dependency Injection bootstrappers - being responsible for gluing your application together - are a vital part of your application, they are seldom put under test. I don’t see any reason why they shouldn’t be though. The cost of these tests is negligible, definitely if you compare it to the cost of the often catastrophical outcome of bugs in your bootstrappers. I encourage you to take a look at the commit history of your DI bootstrappers; I bet they change a lot. Wouldn’t it be nice to have a set of tests that proves that the dependency container still behaves like you expect it to at runtime? Next to proving correctness, I think writing these tests also helps you discover various behaviours of your DI container, which is a valuable investment in itself. ...

February 6, 2012 · 3 min · Jef Claes

A solar storm anecdote

Last week, several news channels reported on the strongest solar storm since 2005. This news item reminded me of a peculiar support ticket we received one gray Monday morning a few years ago, when I was still writing software for fire departments. # Ticket 7238 Subject: **AVL broken** Status: New Description 06:22 Vehicles stay mostly stationary on the map, even when we are positive they are en route. Fire departments that have to cover a large area - and are wealthy enough - often use AVL (Automatic Vehicle Location) to track their vehicles and visualize them on a map. This is extremely valuable, because you always want to dispatch the vehicles with the smallest response time to a high priority intervention. Also being able to advise drivers of possible blockages and toxic gas clouds can save lives. To be able to track a vehicle, an AVL module is installed into each vehicle’s cockpit. This module uses GPS to determine the location and sends the location data over GPRS to a central server. ...

February 1, 2012 · 3 min · Jef Claes

How Wikipedia uses HTML5 to save bandwidth

Something I hadn’t noticed until recently is that Wikipedia tries to use the browser’s native SVG support to render certain images. For example, if you search for a high resolution image of your country’s flag, you will probably end up viewing an SVG. Wikipedia also offers downloads to the image rendered as a PNG though. Next to being able to scale to an arbitrary size without suffering data loss, the SVG data format allows images to be far more compact. Basically, SVG is just XML, which also means it can be easily compressed to make its size even smaller. For example, this is the (uncompressed) SVG for the flag of the Kingdom of Belgium. ...

January 19, 2012 · 2 min · Jef Claes

Autocorrecting unknown actions using the Levenshtein distance

This weekend I prototyped an idea I had earlier this week: autocorrecting unknown actions in ASP.NET MVC. Handling unknown actions To give you an example, let’s say I have a Home controller with an action named Kitten on it. If there is an incoming route for the Home controller with Kitty (instead of Kitten) as the action name, the controller will not be able to invoke any action method and instead will call the HandleUnknownAction method. ...

January 15, 2012 · 5 min · Jef Claes

2011 Annual Review

Since the end of the year is approaching, I would like to look back on 2011 and take a peek at 2012. Unlike the years before, I’m hardly setting any goals this year. Interests change so quickly, and new opportunities present themselves so regularly, I feel like it might be ignorant to set these things in stone. My career The year started out interesting, working on a brand new product for fire departments at Ferranti Computer Systems. Although my role in this project should have been fairly satisfying, I still felt like my position back then failed to fill a certain void. That’s why I decided to take the leap into the Great Unknown. ...

December 26, 2011 · 4 min · Jef Claes

2011's most read posts

I compiled a list of most popular posts that were published on this blog in 2011. Unlike last year, and the year before that, this year it’s not a strict top five list. While analyzing the statistics, I found out that a few topics -covered over multiple posts - were popular this year. Preparing for my HTML5 Webcamps session on WebSockets, I wrote a few posts on the Microsoft WebSockets prototype. I published a step-by-step guide on how to get the prototype working on your machine. A little later I also published two posts covering the internals of the client and server WebSockets prototype. I’m not surprised search drove a lot of traffic to these posts. Microsoft hardly tried to make it easy to play with the prototype: no tutorials, no source, nothing. Now the specification is stable, and WCF 4.5 has WebSockets support out of the box, I suspect MS will make greater evangelizing efforts. Or maybe, they will wait until one of their browsers support it. ...

December 17, 2011 · 2 min · Jef Claes

When should you take performance into consideration?

Before publishing my previous post on rewriting an if, I knew some people would hate it, because the refactored construct is less performant. Although I think performance is important, relevant performance improvements are, apart from in tight loops, hardly ever to find in language constructs. To put it more bluntly, they are a waste of time. When translating your thoughts into code, you should aim to make your intentions as clear as possible for the person who comes after you. Don’t obfuscate your code for an negligible performance improvement. ...

November 27, 2011 · 1 min · Jef Claes

Rewriting an if

Yesterday I came across an if statement that looked something like this. if (arg == "a" || arg == "b" || arg == "c" || arg == "d" || arg == "e") { Console.WriteLine(true); } An alternative way of writing this could look like this. if (new [] { "a", "b", "c", "d", "e" }.Contains(arg)) Console.WriteLine(true); I can’t remember in which Github repository I spotted this technique, but I’m sure it was written in something other than C#. I think it works for C# as well though. The language hardly gets in the way, although it would be nice to be able to drop the new. ...

November 24, 2011 · 1 min · Jef Claes

Blame no one but yourself

Blame no one but yourself. This is one of the few quotes I remember months after reading this book. Although it’s a harsh statement, there definitely is some truth to it. Once I started observing my own behavior when faced with failure, I caught myself regularly blaming others for failures to which I am - at least - an accomplice. Think about it. You might be guilty of this too. Frustrated with management because you missed their too tight deadline? Did you tell your project manager that taking that ‘one small’ task in between would get you behind on schedule? Dissapointed by your team mate because he messed up the task you asked him to do? Are you sure you gave him all the information and provided enough feedback? Tired of doing the same repetitive task over and over? Why haven’t you automated it yet? Not happy with a certain implementation? Did you speak up and propose alternative solutions? ...

November 23, 2011 · 1 min · Jef Claes

Daydreaming about jQuery Mobile and the WebAPI

I recently blogged about programming for the future of mobile with jQuery Mobile and the WebAPI. You probably heard that jQuery Mobile 1.0 was released earlier this week. Although it will take a while before we will see some actual results from the WebAPI initiative, that shouldn’t keep us from letting our minds play with things that might be possible one day using the WebAPI. The thoughts in this post were provoked by an interesting comment Kristof Claes left on my previous post. ...

November 20, 2011 · 3 min · Jef Claes