Do real, professional programmers work this way? It is romantic to think of hacking away in front of a glowing screen at 3am, but I believe most work gets done during the actual work day. Often hacking at night means you are writing code but not making progress, which seems to be the problem with this "disgruntled developer".
Set a schedule, start working in the morning and stop working in the evening, and your sessions will be much more productive and produce higher quality work than these late night, crazed, caffeine-fueled sessions.