It's midnight and I really want to be coding. I'm half way or so through adding a git-annex-shell to git-annex, which will enable some nice features with ssh access. I've done the research, and written the documentation[1], laid all the necessary refactoring groundwork, and written much of the code and just have to connect it all up and test it.

This is a dangerous point to be at, because I have it all in my head, but I'm tired. If I start coding now, I could make a stupid mistake and find myself stuck in a blind alley at 5 am. I've been there before. Even if I avoid hard stuff, I'd surely look up and an hour or more would have gone by, it'd be past 1 am -- and I know that once I stop coding it can take me hours to spin my thoughts back down to the point where I can go to sleep.

Also, I can feel the back of my mind still working on something. Some bits feel like they might not quite mesh up right in my mental model. I don't consciously know what the problem is. I need to sleep on it; it will probably be clearer later. Like yesterday when I lifted a bag of groceries into the car and paused, realizing code I'd written two months ago had a major bug, one I'd never seen, in an edge case that had never came up, but was surely there.

I always assumed that when programmers got older and stopped coding late it was because they couldn't take the strain. Nah. We're just coding even as we sleep. :)

[1] Documentation is where I do my design. This is why git-annex has quantities of documentation that Linux Weekly News finds surprising.

dump it and go to sleep
Your policy of design documenting first is a very good one. It is very close, and maybe better, than test driven design (or maybe they are two steps towards writing the solution). One of the steps I add is to write comments with the idea of the algorithm and then fill the space between comments with the code that implements the comment just above it. You get the idea. That way my code is fairly well commented, specially the hardest parts. What I do while in this 'I have the idea but I'm too tired to implement it' is to just dump the comments and go to sleep. Maybe you can do the same, and if the resulting code is too obvious in the morning, you can get rid of the comments (I almost never do, as sometimes one line of code can be replaced later by more complex code).
Comment by Marcos
Very familiar

You describe it very well, this sounds familiar to me. I find it very hard to decide to quit when I've almost finished a feature branch. The only thing that sometimes works for me is to avoid starting on something new towards the end of the evening, so I don't fall for this trap. I try to do smaller tedious things, like triaging bugs, instead.

Btw, the links in your RSS feed seem to be referring to, which I can't resolve. Is there something broken there perhaps?

Comment by jelmer
comment 3

Yeah, I'm sure part of the problem has been coding in haskell, which knocks my productivity down, so I started the feature branch at noon, not in the evening, and still wasn't done. ;)

Re "gnu", interesting breakage. Looks like I must have typoed sometime and used the ikiwiki setup file of my laptop, which is only available on IPv6. Anyhow, fixed.

Comment by joey