views:

282

answers:

7

I'm looking for a tool with which I can annotate source code.

I have some 3rd party source code (JavaScript) I need to understand and I don't want to change it (add inline comments) so that

  • line numbers can stay intact (for communication with others),
  • I can avoid accidentally changing something and
  • my annotations stand out compared to the authors comments.

Normally I would print the whole thing out an scribble on it, but the code is too long for that and I need to share it per email. I would be great if one could do some like that including being able to create "links" between so places in the code, possibly even visually with a lines or arrows.

+1  A: 

You have difficult requirements. I don't know of such tool. Nevertheless as a more general purpose tool, I can recommend Yui Doc (download here).

ivo
Unfortunately I don't think normal documentaion generators will help me much. The code I have has heavy use of anonymous functions for closures, higher order functions and currying.
RoToRa
+10  A: 

If you would usually print it (if it were shorter), why not print it to a PDF and then use a PDF viewer that supports comments, like Foxit Reader? :)

OregonGhost
+1: certainly a better general-purpose answer than mine.
High Performance Mark
This sounds like an approachable way. I thinking of something similar with annotations in a word processor.
RoToRa
I uses Open Office to comment the code and keep it in this format for reviewing purposes.
Shivam
This is exactly what I thought of doing as I was reading the question. You could even combine this with the LaTeX suggestion to get pretty printing. To make collaboration easier and more "shared" you could look at uploading to scribd, but I'm not sure if that would be secure enough for your needs or if it allows the annotations you describe.
Chris Cleeland
I'm accepting this answer, despite that three new promising answers came in during the weekend. However I don't have the time right now to check them out properly before the bounty time runs out.
RoToRa
A: 

You can certainly do what you want to with LaTeX and its listings package. But if you are not already a LaTeX user you might think that a hard way to go.

High Performance Mark
A: 

I'd build a glamour browser for it. (If spending half a day building it wouldn't be too much).

[edit] Glamour is a toolkit for building browsers on a model. The model would here consist of the various parts of the file(s) and the comments and attributes you'd like to add. This would allow you to easily navigate through the source and comments, to select only parts with (or without) certain attributes. There is a video and slides. Official page, Source

Stephan Eggermont
What is Glamour supposed to be? I've went over the web page several times und simply don't understand...
RoToRa
+1  A: 

start a github project and post the code there, github includes annotation abilities OOB.

Jason
The annotations functionality are really good. I was very sceptical in the beginning, but now I am convinced they work great.
Peter Tillemans
Could you give a a link where this feature is described? I can't seem find anything on the github site.
RoToRa
A: 

How about using google wave with syntaxy (http://wave-samples-gallery.appspot.com/about_app?app_id=14008) bot?

Maciek Sawicki
+2  A: 

I would use email to comment and pastebin to host and highlight @h@ lines with links in the email text.
OR
some code-review tool (like codestricker or reviewboard for example)

RC