Is it easy to intentionally write bad code? When you look at a lot of the software out in the industry is seems that the answer has to be 'yes.' We're surrounded by bad code, but that isn't the same thing as writing it intentionally.

In trainings and workshops over the past couple of months, I've asked people to sit down and intentionally write the worst code that they can imagine. A lot of it ends up being obtuse, with redundant and obscure calculations, but somehow it always seems to miss the mark - it's not like the "bad code" that we typically encounter, and it's worth wondering why.

Anyway, I offer this as a challenge to you. Try to intentionally write the worst code that you can and see how you feel about it. Notice how that code is different from bad code that you tend to see.

There's a psychologist named Fritz Perls who coined something he called the 'Law of Paradoxical Intention.' If you are blocked on something, try to do the exact opposite of what you are trying to do. It turns out that there's a lot you can learn about good design by intentionally trying to write bad code. Just, please, don't ever check it in.

If you do this kata, please post your results and reflections online. I'll be blogging reflections about what I've learned so far soon.

Edit: I may have gotten this idea transitively from Jason Gorman. I heard that he ran a 'bad code kata' at a QCON conference last year.