The unit in unit-testing

The interpretation of “unit” in unit testing to mean a class is wrong. This and an unfortunate misunderstanding of Kent Beck’s “run unit tests in isolation” still drive developers to test their classes in extreme isolation with undesirable consequences that are then attributed to test-driven development (TDD) as being unsustainable. When we make our test …

Learning BASE64 encoding

BASE64 encoding is so prevalent that it is worth learning how it works and how to code your own implementation. The point of BASE64 is to communicate binary data as text, using only characters that are likely to exist on most computer platforms. These safe characters are known as the BASE64 alphabet and are the letters …

How we use SQL Server Data Tools

This post describes the process that we use to develop databases with SQL Server Data Tools (SSDT) in Visual Studio. For this process to work, the conventions below must be respected. Use the live database as the gold standard for schema objects (and data). Deploy only database projects that have been built successfully. Deploy to a database that matches …

Three golden rules to tackle complexity

Tim Newing, the IT director of Camelot, shares three golden rules to manage complexity in IT projects. Think of a collection of simple solutions instead of one complex project. Manage outside the ‘business as usual’. In other words, set up a different structure so that the project team is not distracted by the normal business. …

How to identify and fix an anaemic domain model

CRUD applications tend to have classes consisting of many accessor methods but little business logic, the behaviour being implemented at a higher level in manager (or god) classes. This signals that the domain model is anaemic. While many developers know the symptoms, few know how to fix the problem. Anaemic classes have no responsibility other …

How to switch off a screen laptop under Linux

This post describes how to save power on a laptop running Linux by switching off the screen backlight. The instructions are tested on a Dell Latitude C810 running Ubuntu Linux 5.10. The first part is straightforward: set the correct governor for the CPU frequency with the following command. echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor This is executed …

Rapid web development

I am experimenting with the following technique to speed up web application development with Java. First, define an interface called Controller with a single method called handleRequest that takes an HttpServletRequest and an HttpServletResponse as arguments. The method should also throw an Exception. package web; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public interface Controller { public void …