It may sound strange to do development work while your sleeping, but I have been doing it for about a year now. The concept is extremely simple, but the outcome can be a super time saver. You might have already experienced what I am about to describe, but bear with me anyway. Think to a time when you were under a deadline and you were stuck on an issue that was slowing you down. Perhaps after thinking about it for a while you had a dream about the problem. For whatever reason you woke up with a possible solution to the problem.
Whenever you run into an issue that is taking more time than it should simply write it down and stop physically working on it. It will be resolved if you think about it and it is a good way to avoid only working hard. The next step you take is to simply look at these issues before you go to sleep. Read through the list and then start working through them again in your head. Identify what the problem was and why your initial attempt did not resolve it. While you are doing this simply lay down in bed and close your eyes. Keep working through the problem and in no time at all you will probably be asleep. Whenever you wake up in the morning simply consult the list again and work through the issues and possible solutions in your head. I find it is best to think about them in the shower. By the time you are done with your shower you will more than likely have the solution to your problem. I find it best to write down this solution so that I do not forget it. Just remember to put some clothes on before you rush out of the bathroom to write down your solution.
Don’t worry if the above does not work initially, it takes some practice. I have found that once accustomed to this practice that the solutions seem to come much more easily. Also, this can work for things beyond programming problems.
Again, all you have to do is think about your problem as you are going to sleep and again in the morning when you wake up as you are going through your routine. Very simple, yet extremely effective at solving any issue. I think that this is a way to combine working hard and working smart. After all, if you not only work hard but also work smart you should be twice as productive as if you were only doing one.
Be careful though, if you get an exception in your dream then your dream can quickly become a nightmare.