

Ask HN: Separate code and comments? - trippplezz

I have a really weird problem at work. The project that I workon was developed mainly by a single person, and for some strange reason he doesn't want any comments in the code, quite literally.<p>Since I want to add comments in the code while I browse through the code making small modifications, basically getting accustommed to it, I was thinking about the possible solutions to this case:<p>* add the comments in my local working copy, then preprocess somehow the source files to strip the comments just before commit. I'm not sure how this will work when pulling/updating from the repo.<p>* An editor/IDE that have the ability to keep the comments separately as metadata and show them nicely for view/edit in its editor windows. Havent't found any still...<p>A similar question: http://stackoverflow.com/questions/1856133/separate-code-and-comments
======
nfm
This sounds like "A Bad Idea" to me.

What's the real issue? Is it that the original coder refuses any comments, or
that the OP is a particularly liberal commenter?

In either case, I don't think a technical solution will solve the actual
problem. This falls into the same basket as naming conventions, tabs vs
spaces, and commit message conventions: You need to figure out something that
works for the team.

------
rames
I don't like the idea of excluding all comments from the code. However
excluding useless or local comments from a repository can be legitimate.

Two potential solutions:

1) Use a regexp to match your comments and trim your code before committing.
That shouldn't be too hard, and is pretty efficient since you only need to
care about it before submitting your code. If there are existing comments that
should stay in the code, use a specific markup for your comments.

2) Another idea could be to maintain a stgit patch integrating all the
comments. This requires a bit of process though.

------
JoachimSchipper
Vim has folds that can keep large-and-rarely-relevant sections (e.g. the
prototypical half-filled Javadoc comment) nicely hidden. His editor may have a
similar capability.

------
wavephorm
Your coworker is an idiot and/or doesn't work well others. Don't put up with
this.

