Stating the problem resolves it
When I have a programming problem, often the answer comes to me while writing the question on Stack Overflow. Trying to explain your code to others forces you to simplify it by removing anything that is not relevant to the problem itself. The problem often becomes head-smacking clear once you remove all the cruft.