Programming is sometimes a mind boggling and perplexing thing. If you know what you want to do, and how to do it, then it is a breeze and you can whip out a thousand lines a day, write an entire app over the weekend. If you don't know what you want to do or how to exactly do it then it can drag on for weeks and months. I'm like this a lot. Sometimes it just seems like I'm a whirlwind, my fingers flying off the keyboard in hypersonic rhythm. Other times, I just stare at the blank page, uncertain what to write.
Usually, I'm sort of a cowboy when it comes to writing code. I'll jump right in without all the facts and just start punching away. Some people would think this imprudent, being the types to agonize over every detail before committing anything to disk. I don't care so much. I'll even write down garbage lines that I know are invalid. I'll solve something temporarily in a way I'd consider a hack, knowing that I'll be back to fix it later. I am thinking about the problem, working toward the best solution, its just that I think by writing code. I need to see bits and pieces of the idea take shape in front of me. Only then do I gain perspective. I'm generally comfortable working this way, because I'm also comfortable in throwing it all away and starting over. This is not a very common trait for programmers. It's more like building sand castles than building bridges.
Yet, sometimes the problem in front of me is so different, so complicated I don't even know where to start. I hesitate at even starting to write code, even though I know this usually helps me think through the problem. Usually after a few false starts something will click and I'll see an adequate solution and then I'm off to the races. But then, I usually had some glimmer of understanding to begin with. When I don't even have that, then I don't even bother. I actually don't even try to think about it. My best plan of attack is to put it completely out of my mind.
You might think that's a really bizarre approach, not to even think of it at all. You might think I was procrastinating, goofing off. Heck, when I find myself in this predicament I might switch to working on something else, though usually this isn't the right thing either. The best thing is to change my environment completely. Do something else. Shut down the computer and walk away.
You see, the way I figure it, my background processors are still busy think through the problem. At least the portion of my brain that does all the pattern matching and what not, that puts odd things together and interjects with aha moments from time to time. Eventually, that part of my brain will filter out the nonsense and give way to making some sense out of the madness. It's not that the solution will suddenly become clear, but some part of it will, enough to send me back to the keyboard.