Originally Posted by
aussiemcgr
Yeah, it's true for everyone.
There are two bits of advice I can give:
1. Walk away for awhile (if you can). Just because you are not actively thinking about the problem doesn't mean your brain is not still working on it. You'd be surprised how many times I've come up to a solution to a problem after a good night's sleep or even a bathroom break. I've found I come up with the solutions to the hardest problems when I'm not thinking about the problem.
Indeed. For this particular problem, I left my computer and went off to the gym for my daily exercise, a process which takes about 90 minutes (30 minutes travel to and from the gym, and an hour on the treadmill). The solution came about 15 minutes into my workout. I didn't have anything to write it down with, so I forgot 10 minutes later, remembered 10 minutes after that, and sorta went into that cycle for a while until I was back home and did have the opportunity to write it down and eventually implement it.
The specific problem involved PHP, not Java, and the question was this: "How do I set up a series of hyperlinks that reloads the same page, but after the reload the page knows which hyperlink was clicked?" I knew that you could do some stuff involving GET and using the query string, but my brain just wasn't putting 2 and 2 together.
2. Break the problem down to its most basic components. Continue to break it down until you can't anymore, then make a plan for tackling each component individually, then figure out how to tie together all of those plans, and only then, after you've figured out your overall plan, should you consider implementing it.
I find that in most cases of mental degeneration, I can't even do that. Breaking stuff down goes better when I'm more fresh.