Re:The Problem With Comments
by iambot on Friday September 07, 2012 @04:42AM
(#4488156)
Reading through this article, I thought of an idea. What if comments were made using an annotation-like/type input, so you select the lines of code that it pertains to, then enter your message. So whenever the cursor/pointer is within a block of code, the relevant comment/annotation is highlighted/made obvious - ie: like a post-it
[ Parent
| on HN ]
Yes but this would go against the long tradition of coding with flat text files. See http://stackoverflow.com/questions/160633/why-do-we-still-pr...
Some of us already use metadata in our daily coding - for example commit messages.
Recently I've noticed, that I comment less, and instead write more information in commit messages, and do svn blame more often.
It's better, because it has more context (you see to which changes this comment is relevant), and is always up-to-date, because you always write fresh commit messages.
We have a rule in company, that you have to add task number from JIRA to each commit message, and this alone is a huge improvement - you can always check WHY some change was made).
not necessarily, you could do what docco does and assume that comments pertain to the lines of code immediately below them, up until the next comment or the end of the function
Re:The Problem With Comments
by SquareWheel on Friday September 07, 2012 @05:00AM
(#4488213)
Well, we could use a commented syntax and build editor support for it. If HTML, <!-- COMMENT: lorem ipsum -->. If C/Java/etc. then the same but with /* */.
Tags in comments already exist, most common are probably TODO, FIXME and NOTE.
Now that would take the gray comments a step further by making them completely invisible :)
I can't really see the benefit of hunting the comments from your code with cursor. It definitely would make it even more unlikely that comments aren't updated when code is changed.