One thing that helps at lot with programming is my tendency to visualize branches and dependencies as graphs/trees as I read/write code. This makes aberrations and code smells extremely obvious. A dirty hack makes you go from something that looks like a beautiful fine-toothed comb to a comb with a cancerous tumor on it.