Working with code

Riffing off Jonathan Lange on writing good (and reviewable) code (by the way, the filenames are a bit obscure, as in I didn’t know review comments tended to be passed around in .diff files, but here’s the 121kB review in question), a point I’ve been meaning to make somewhere, anywhere, for a while now: making large codebases grep-friendly is important to me. Specifically, when I enter a large codebase without any intention of becoming familiar with it (ie I’m fixing a bug) I really really really like to be able to grep for function names I’m coming across. (Really, I should probably use slightly more sophisticated tools, but they work on more or less the same principle.)

I was digging around in the Nevow codebase a couple of years for goodness-knows-what (actually, I think I know, and I really should look for it again, but that’s not relevant here) and there were factories, factory-factories and factory-factory-factories, or something like that. It was very difficult to find the implementation of any of the many many objects that were slipping around my hands, because they were implemented with a totally different class name, or several of them, and then sort of assembled from pieces. Damn it’s hard to fix bugs in code like that.