Software Design X-Rays by Adam Tornhill

This is a book about how to detect bad code from code base with the help of code's history from git. I was surprised how simple things and techniques book uncovered about code quality. The key point is the time. We shouldn't do just static analysis from our current code but analyze how our code has lived and progressed. Tornhill calls this behavioral code analysis. I will explain some interesting things from the book, like hotspot analysis and what are surprises in code and why they can be really expensive. After reading the book I understood how to improve code quality cost-effectively.

Always Write Unit Tests

Unit tests are my passion. I always write them and I also encourage others to write them and even have taught developers to write unit tests. But I am quite surprised how often developers don't write unit tests. There is a lot of benefits for writing unit tests. In this blog post, I will explain three main reasons why every developer should always write unit tests.

Automatic Rollback to Integration Tests in C#

This is something that has made my integration tests better. You define a test method to run in transaction and rollback at the end of each test. This makes it possible to write integration tests that write to the database. And tests won't leave any "garbage" there because rollback at the end of the test undoes all database updates (and inserts and deletes). If this is possible in your language and testing framework I strongly recommend it. In this blog post I will explain how you can do it with NUnit in C#.