1. Just before bed - this is the best time because it allows your mind to process information while you're sleeping uninterrupted.
2. Just after waking up - when you wake up, your brain waves are at an extremely low point and theyre dominated by alpha waves. Alpha wave states are very good wave states to be in when you're programming yourself. So, since you're already at that low point, it makes it much easier to relax and allow yourself to start doing some programming sessions in the morning.
3. After exercising - much easier to get your body to relax after doing strenuous exercise. At that point in time, because your body is starting to recuperate from those strenuous exercises, its an ideal time to get your body into a further relaxed state to do some programming.