Songs of Doom

Code Documentation

March 18, 2005, 6:33 pm

Documenting code sucks. It’s official. No-one likes doing it. This probably goes someway towards explaining why Psi is basically undocumented. Someone asked on the forums today how [s]he could understand Psi’s code, and my only response was “Use the Source, Luke” apart from having three capitalised words out of 4, it’s also no help at all. So, using my amazing powers of perception, I’ve realised that we need Psi’s source documented. How do we achieve this? If we just stop development until it’s done, 0.10 will never arrive (there are too many prophecies about this already).
I have a plan, however, a plan so cunning you could stick a tail on it and call it a weasel. Or possibly a cow, I’m uncertain.
In future, whenever anyone makes a patch for Psi, they can check each method that they modify. It it’s been documented already, great, if not, they can doxygen it, as they obviously understand the method, or they wouldn’t be modifying it. It won’t produce docs overnight, but it’s a start.
The hard part will be persuading people that they want to do this.

6 Responses to “Code Documentation”

mblsha wrote on March 18, 2005

I’d also like to have a separate mailing list for all CVS commits. All commits should result in a mail to that maillist, wth commit’s diff file attached. So we will instantly know who to punish for not obeying teh rules.

Remko Troncon wrote on March 18, 2005

Hey, I like documenting my own code, because i’m generally proud of the code i write! I take pride in what i do, and consider it some kind of art. My opinion is that, if you don’t like documenting your own code, it means that your code is ugly and/or you don’t like your own code.

Kev wrote on March 18, 2005

@mblsha: It’s already underway.

@remko: I’d rather code than document, it’s that simple. I also detest doccing other people’s code, so going through Psi doesn’t appeal at all :)

Eric Muehlstein wrote on March 18, 2005

It’s definitely a shame that Psi isn’t well commented - I’m trying to learn about C++/Qt and wish THE FORCE was with me. Perhaps this should be mentioned on the list as many people are in the process of re-writing certain parts of the codebase.

Hal wrote on March 18, 2005

Hmm. Not sure I want to attach the actual diffs. I’m writing an email to psi-devel on the subject now.

Perry Lorier wrote on March 28, 2005

For undernet’s ircu, we had 4 developers all pick a couple of files each and we documented (almost) every symbol in them. It didn’t take us long a couple of hours, I guess that probably reflects on IRCu being reasonably well documented to start with.

There are however some symbols that are very important to document. The major datastructures for your program are usually at the top of this list, and the functions that manipulate them. the Client, Channel and Membership structures pretty much describe most of ircu, theres lots of other bits that aren’t covered by that (Bans etc), but it’s enough for people to get the general jist of whats going on.

Pick a couple of critical functions (eg dealing with what happens when a new presence is recieved, or a new message) and document them and every function they call, it will probably take you less than an hour and you’ll cover all the important things that people that are going to hack on the code are probably going to care about.

Bad Behavior has blocked 799 access attempts in the last 7 days.