Tips for running a code Kata

Code katas such as the classic bowling game kata by uncle bob are a good way of fostering TDD best practice in your team. Here, in no particular order, are a few hints for running them I have picked up over the last few months. Start with a subject that everyone knows. For example with the bowling game don’t assume that everyone knows how to play and how to score the game....

February 14, 2016 · 3 min · 467 words · Alastair Crabtree

What type of test is that?

Tests help you ensure your code works, but they come in several shapes and sizes. Here are the four key ones I use, and how to spot the difference. Unit tests AKA: TDD, fast tests, “tests” Usually written by: Developers Time to run one: few ms Time to run suite: few secs - 3m Component under test: one or more related classes/types usually in the same module. Success: You have hundreds of quick running tests that cover 80% of application code....

February 2, 2016 · 2 min · 410 words · Alastair Crabtree

QuickTip: Comparing strings in c# ignoring case? ToLower() is not the answer.

When doing a code review I often see code comparing two strings where the developer wants the comparison to be case insensitive and chose to use ToLower() or ToUpper() and == to get the job done. However because the dot net framework handles different cultures just using ToUpper/Lower could produce unpredictable results depending on the config of the machine your code is running on. Instead you should use the OrdinalIgnoreCase option on string....

January 11, 2016 · 1 min · 99 words · Alastair Crabtree

Encrypting configuration files in asp.net during deployment

Assuming you are running your asp.net website on windows and IIS it is possible to encrypt your web.config file with a little bit of scripting during your website deployment. However I would always ask why do you want to do this? IIS will not serve this file by default and if you are sensible your production websites file system should be well secured already. But assuming you have a good reason, here is how....

December 14, 2015 · 2 min · 383 words · Alastair Crabtree

Continuous Integration - am I doing it right?

You have a substantial development project with several people working on it and you expect to be around for a while. Having your source built by Teamcity/TFS/Jenkins etc is a good start, but there is plenty more you should probably be doing. To help out, here is my checklist of a good quality continuous integration/continuous delivery pipeline. It takes a while and some experience to set it all up but the long term benefits to developer productivity are well worth it....

November 23, 2015 · 3 min · 462 words · Alastair Crabtree