Imagination might not be the first quality you think of when you think of people who build computer systems. However, I think it’s really helpful for many parts of the process – designing, building and testing it. Old English Digression First, a digression into Scandinavia via UK primary schools. This is my friend Tim Eagling … Continue reading Imagination
Your tests are code too
Imagine if someone submitted some production code for review, which had lots of magic numbers and magic text, lots of repetition, long methods etc. Would you say that code was OK? How much of your unit or integration test code is like that? Seeing the wood for the trees Part of the problem with test … Continue reading Your tests are code too
Tests as sheep dogs for your code
Tests can act as constraints on your code, a bit like sheep dogs herd sheep into a pen. One sheep dog stops the sheep from straying to the left, another stops them from straying to the right, and another moves them forwards towards the pen. The sheep are free to roam where they wish, if … Continue reading Tests as sheep dogs for your code
Competence vs. Tribalism
There is a sometimes tangled relationship between what we can do and how we think of ourselves. I'm going to look at a part of this below. I can't do X because I'm a Y Have you heard someone (or yourself) ever say something of the form "I can't do X because I'm a Y"? … Continue reading Competence vs. Tribalism
Performance optimisation – for machines or people?
I recently watched a video and listened to a podcast that form an interesting pair of opinions about performance. The video is Patterns for high-performance C# and the podcast is SE-Radio Episode 357: Adam Barr on Software Quality. There are two things where the podcast and video have no differences: the system must behave correctly, … Continue reading Performance optimisation – for machines or people?
Unit testing database queries
In this post I will try to describe an approach to unit testing database queries. It happened to be inspired by some testing I was doing of some C# code, but you could apply the same ideas to other languages. Note that if you’re unit testing stored procedures then I recommend using something like tSQLt, … Continue reading Unit testing database queries
Software Engineering Radio Podcast on Web Scale
I'm still working my way through the back catalogue of Software Engineering Radio. I recently listened to a particularly good episode, with Pat Helland. There were a few things specific to web scale, but generally it was good because he explained general concepts very well. I'll mention two of his explanations here, but I recommend … Continue reading Software Engineering Radio Podcast on Web Scale
Mutation testing
Mutation testing is a way of judging the quality of your tests, just as tests are a way of judging the quality of your code. Usually, the tests that mutation testing works with are automated unit tests. In theory it could apply to manual and/or higher-level tests like integration or system tests, but I hope … Continue reading Mutation testing
Lazy initialisation and threads (in C#)
Lazy initialisation is a way to set up everything needed to initialise something, but put off the initialising until later, usually when the value of the thing-being-initialised is needed for the first time. You might want to use lazy initialisation because something is expensive to initialise, and you might not need it. Or because you … Continue reading Lazy initialisation and threads (in C#)
Documenting ASP.NET REST APIs with Swagger / Swashbuckle
Introduction Swagger is a way to document a REST API, and tools can automate much of this process (but not all of it). At the centre of things is a JSON file that describes the API. You can create this file by hand or use a tool to generate e.g. from the API source code. … Continue reading Documenting ASP.NET REST APIs with Swagger / Swashbuckle