Usually, I write about one single book in a given article, but this is a peculiar occasion. Last months I read both books written by Adam Tornhill: Your Code as a Crime Scene (YCCS) and Software Design X-Rays (SDXR). Despite that three years passed between publishing the two books (YCCS in 2015 and SDXR in 2018), I read them one after the other, which was probably not the wisest decision, even though I enjoyed both.
I have heard a lot about Your Code as a Crime Scene in the craftsmanship community, but mostly from people who also heard about it. You know it’s like I have a friend whose friend heard about someone having read it. Finally, it ended up on the top of my reading backlog and I really enjoyed studying the book and experimenting along the way.
YCCS introduces the concepts from forensic psychology to analyzing legacy code. It uses solely version control data (for most us it’s git) that normally should be available to you for any project nowadays. Clearly, if it’s not the case, you have bigger problems than this book can address. Anyway, extracting data from git and analyzing it with the help of various scripts you can help you for example
- find the hotspots of your code
- analyze the coupling between different parts of the code
- build a knowledge map
While I found Your Code as a Crime Scene a totally innovative book, Sofware Design X-Rays builds on the already introduced ideas of hotspots and change coupling metrics and goes much deeper.
It’s not a repetition of the previous book and it does introduce new directions that were not present in YCCS. Still, obviously it’s not so much a novelty that I would advise you to read it right after the first. Experiment with the ideas introduced in Adam’s first book, let it sink, ask yourself questions and then in a couple of months take the second book. You’ll value it more.
Before writing the next paragraph, I must tell that I have no financial incentives. In the books, Tornhill uses open source scripts available on his github and you’re free to reuse them. Besides, he also built a more elaborate version with more metrics, more configurability and a nice UI called Code Scene. Of course, it’s not for free. Soon we are going to experiment with it on the application I’m working on.
Once we have some measurable results, I’ll write some follow-up posts.
Until then, I recommend you to read first Your Code as a Crime Scene that is interesting even for its references between software development and psychology and a few months later Software Design X-Rays, they are really worth it.
Happy reading!