Consequences of array covariance in C#

Posted on Fri 22 October 2021 in Coding • Tagged with csharp, covariance, cast

In today’s post, I’ll talk about array covariance in C#, how it hid a bug in code that was covered by a passing unit test (*gasp*), and some ideas for how to avoid such bugs.

What is covariance?

In computer science, variance has to do with how complex …

Continue reading

TDD and prototyping—a love story?

Posted on Tue 10 July 2018 in Methodology • Tagged with test, tdd, prototyping

Can you combine Test-Driven Development (TDD) with prototyping? How can you write tests for functionality that is largely unknown? Where do you even start if you’re on unfamiliar ground and you need to explore to learn about possibilities and constraints? How can you write tests when you don’t …

Continue reading

Git-diffing Excel files, part 2

Posted on Tue 02 January 2018 in Tools • Tagged with git, diff, excel

I previously wrote about how to get a useful diff for binary Excel files that reside in a Git repository.

This post adds some details that are big enough to deserve a separate post. They are:

  • User-level configuration of Excel diffing.
  • How to get an Excel diff from git show …

Continue reading

Nashorn's JSObject in context

Posted on Sun 12 November 2017 in Coding • Tagged with java, nashorn

The JSObject interface in Nashorn makes it possible to expose an object to script code and control in detail how it appears and behaves. The purpose of this article is to explain when the different JSObject methods are called during script execution and in some cases how they should be implemented.

Continue reading

Scala pattern matching & lowercase case objects

Posted on Wed 30 November 2016 in Coding • Tagged with scala, functional

I just learned something about pattern matching and case objects in Scala which I thought I’d share.

Continue reading

Git-diffing Excel files

Posted on Fri 04 March 2016 in Tools • Tagged with git, diff, excel

In this post, I’m going to demonstrate how to get a useful diff for binary Excel files that reside in a Git repository. I assume that you’re familiar with Git, and in that case you know that having binary files in a repository is generally not a good …

Continue reading

How Enumerable.Concat brought down a production server

Posted on Wed 26 November 2014 in Coding • Tagged with .net, linq, iis

TL;DR Using Enumerable.Concat to build a long sequence one item at a time is a particularly bad idea, since enumerating the items will consume a lot of stack space.

A while ago, a customer reported that our .NET application running in IIS started crashing on user registration after …

Continue reading

The mysteriously escaped request path in ASP.NET

Posted on Tue 19 November 2013 in Coding • Tagged with, nancy, uri

This blog post answers the question “Why does Uri.AbsolutePath sometimes return an escaped path and sometimes an unescaped path for the request URL in an ASP.NET application?”

I spent some time googling for a possible reason, but search terms like URL/URI, request, path, encoding, and escaping are …

Continue reading

How git changed my commit behavior

Posted on Fri 11 October 2013 in Opinion • Tagged with git, vcs, commit

Git is my version control system of choice nowadays. Its feature set fits extremely well with my usual software development workflow, and there are so many aspects of git that I could write about, but this particular blog post is about commit behavior.

There is nothing religious about this post …

Continue reading

Why I hate implicit return in CoffeeScript

Posted on Fri 26 October 2012 in Coding • Tagged with coffeescript, javascript

CoffeeScript is “a little language that compiles into JavaScript.” If you haven’t seen or tried it, go check it out! I’ve been using it in a project for a while now, and its obvious advantage over pure JavaScript is that it is very concise and has high expressive …

Continue reading