Ah, but in higher-level languages comments are bugs.
Knuth would disagree.
Haskell has a `mode' called Literate Haskell, were everything is a comment, unless you specify otherwise (e.g. enclose it in \begin{code} and \end{code} pairs).
Well, I would say that Knuth doesn't put comments, he puts chapters. His code is quite a pleasure to read.
I don't yet seem to be at that level of evolution yet.
Re:Source code from Apollo 11 open-sourced
by jonursenbach on Monday July 20, 2009 @07:16PM
(#715419)
Commenting _too_ much can degrade the quality of code. Be smart when commenting.
There is definitely a balance, but high-level code, when well written, is self-documenting. Comments should justify why something has been coded the way it has, not tell others what the code does (unless it's justifiably unreadable).
Yes comments should be about intent, the implementation (code) should be obvious. Often when maintaining legacy code the most important thing is to understand what the original programmer wanted to do and why. Not that there aren't some complete idiots writing code - but you can't know that this seemingly stupid thing you see in your editor window wasn't the best decision at the time given some constraint that no longer exists now.
Some deep algorithms may require more comments about their inner workings.
Re:Source code from Apollo 11 open-sourced
by basugasubaku on Monday July 20, 2009 @11:06PM
(#715647)
# YOU WOULD THINK THEY CAN COMMENT WITHOUT YELLING.
Re:Source code from Apollo 11 open-sourced
by helloworld on Tuesday July 21, 2009 @12:25AM
(#715728)
Um, dude, back in the day, all you got were CAPS. (And that was still true ten years later, in 1979, with my Apple II Plus.)
Re:Source code from Apollo 11 open-sourced
by basugasubaku on Tuesday July 21, 2009 @02:13AM
(#715816)
Are you sure? AFAIK the earliest LISP (1958) supported lowercase, PDP-1 (1960) had lowercase, the ancient SAIL keyboards (1960s) even had Greek letters on them.
Anything that was done using punchcards was all uppercase.
Btw, did you know that the 'SAIL' assembler/debugger was called 'FAIL' ?
I sometimes wish that low percentages of comments would generate a fatal error!