Sample code of chapter 2 of my book "Taming the Bad Code".