I like to program whenever I'm not tired. I usually listen to music with headphones on. This helps to block out other people in the office or the tv/other people at home.
Programming when tired leads to errors and forgetting where you left off when you have to stop or take a break.
I rarely program outside. The glare on the screen is too much to deal with.