Don’t comment out your tests, there are better alternatives!

You’ve either done it yourself or you’ve seen others done it. Uncommented a whole test, a test fixture or maybe an entire file.

I know, it’s so easy to press Ctrl+A, Ctrl+K+C to uncomment everything. You’re probably changing an interface. Most likely, the methods that are tested don’t exist anymore in the form in which the tests calls them. You probably just click and drag the mouse and comment out a block. But please, be careful. I’ve seen a lot of examples where an entire file ended up commented out for months. Only to turn out to be crucial, because it tested a very important scenario.

First and foremost, if you are refactoring, please look at the tests as if it’s production code. You are best off getting the tests to compile, even if that takes extra time and you’d rather pull the main code back on its feet before you worry about the tests. Be aware that the “it takes extra time…” is a fallacy. It just takes time. It’s part of your job. It’s not less important than the rest of the code. Probably the contrary. You’re better off keeping the tests compiling all the time.

But if you must, please, don’t comment out a whole test or whole fixture. If you must, then do it like this, instead:

    public void SomeMethod_SomeCondition_ShouldDoSomething()
        // Arrange
        // SystemUnderTest sut = new SystemUnderTest();
        // sut.SetupSomeData();

        // Act
        // sut.DoesNotCompile();

        // Assert
        // Assert.IsTrue(sut.SomePredicateDoesNotCompile());
        Assert.Fail("TODO: Fix this test");

That way, at least your test suite will alert you that there are a couple of tests you still need to fix. And you won’t have a colleague pointing out to you that that commit you did two months ago effectively deleted some really important tests…

Painting: Weather balloon

I finished this painting a while back, but didn’t put it up yet. Forgot to sign it too.. Oh well.. I’m pretty pleased with the end result anyway 🙂

Again, it’s based off real live material. (A screenshot of a documentary. I wonder who recognizes it … 🙂 )

Photo on our balcony

On the photograph, the varnish looks rather blotchy. The colours are not as vibrant as I’d have liked, but this is the first painting I did where I didn’t plan the whole thing from the start. The lighting also doesn’t do it justice, because the weather balloon isn’t as bright in the painting as it looks here. So, despite the colors being a bit off in both the painting and photos of the painting, I’m very happy with the end result and the lessons learned 🙂



Time travel and parallel universes

Suppose you’re working on a software project and you’ve tagged your release 0.1.0. It has been shipped and now you’re working on version 1.0.0. You’re reworking quite a lot. It’s a major release after all, a lot to be done 🙂

In comes someone who sees version 0.1.0 and thinks to him/herself: “Oooh, can you maybe add some functionality on top of that? I don’t want to wait for 1.0.0, that takes too long.”

Although the ‘building a house’ metaphor is a strained one when it comes to software, it can be used to abstract away from the nitty gritty detail of software development and describe things like project management and development strategies. Today, let’s discover some of the superpowers we have in software-land, and what their limitations are. And let’s use our superpowers to build a house 😉

Version control, especially Git, grants you the powers to:

  • work in parallel universes (branch)
  • go back in time (branch from older release or commit in the past)
  • automatically replay anything you did in a parallel universe in another parallel universe (merge or rebase)

This is convenient when we’re doing things that are unrelated. Two developers could branch from trunk (or master or main stream) and work in their own branches quite comfortably, as long as they don’t do conflicting things in the code base. Or, to strain the house metaphor to its breaking point: Someone could be installing a new kitchen while another team replaces the roof.

Continue reading

LEDwall Proto 3

Ahh, Christmas holidays. The perfect time to muck about with electronics and software. I never thought I’d enjoy electronics this much.

Admittedly, I didn’t make a lot of changes the LEDwall prototype, I just finished it up. I soldered the base of an Arduino Nano to a little soldering board, installed the Nano, trimmed some wires and I added proper connectors instead of twisting wires together and applying duct tape.

I got rid of the GUI and networking stuff that would allow me to set the program remotely. Instead, I added a little jumper to be able to switch the program every time the Arduino starts. Then, I wrote some code to turn the whole thing into a `Do not disturb’ / ‘I am available’ sign.

Besides the two shown above, I’ve also made a blinking display of the letters ‘O-K’ and ‘N-O’ in green and red respectively. It’s a bit painful to look at so the first option (green circle and red cross) seems most useful. If the jumper isn’t here (if I’ve lost it 😉 ) it shows a spiffy flashing raindrops thing that is sure to induce an epileptic seizure.

Happy holidays!

Thinking inside the box… four of them to be exact

The past few weeks, I’m observing the appearance of a new ‘discovery’.

The discovery is this: You can describe people’s communication style / personality type with four colors!!!111one

There’s RED, for the strong-willed, fast-paced thinkers.
There’s YELLOW, for the sociable, excitable, “ooh, shiny light”-type persons.
There’s BLUE, for the detail-focused, precise analytics.
And GREEN, for the relationship/feeling-oriented person.

It’s a hype. It’s The New Thing. It’s AMAZING. Aannd… it’s really old :’)

Continue reading

Extension to Category Posts in Custom Menu

The WordPress plugin I wrote, Category Posts in Custom Menu, supports custom extensions. Recently, I wrote an extension for someone who wanted to show all posts from some category, say “category A” that were ALSO in “category B” AND NOT in “category C”. So, I helped out (coding, yay) figuring it would give me an idea of whether the extension possibilities I created make sense.

If you’re interested, you can now find all the source code at GitHub. This extension was aptly (ahem) named “cpcm-and-and-not-extension”.

What do a warning, a comment, a test and your backlog have in common?

#warning This is going to be a nitpicky post.

There was once a developer who marked his code with TODO’s.

// TODO does not handle case X
public void Handle()

// TODO clean this up
var ugly = ...

// TODO re-enable after Y is implemented
// if (bla)
// {
// ...
// }

Another developer used warnings.

#warning still have to write test for this
switch (something)
case a: i = 4; break;
case c: i = 1;
default: throw new InvalidOperationException();

I’m writing this blog post to illustrate subtle but significant differences between four mechanisms that can be used for a shared goal: To mark what still needs to be done.

Continue reading

Are you joking “It compiles, ship it!”? You might actually be doing just that…

A while back, I talked with someone about using the Singleton Design Pattern vs. using an IoC container and registering your class as singleton.


IoC containers are regularly bootstrapped wrongly, resulting in your product not working as it should. And you don’t discover that until you startup the product. I’d rather use the Singleton Pattern. That way, the compiler will protect against errors.

Continue reading