Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Commenting

Name: Anonymous 2010-03-29 15:07

Tricky code should not be commented but rewritten

In general, the use of comments should be minimized by making the code self-documenting by appropriate name choices and an explicit logical structure.

Name: Anonymous 2010-03-29 15:16

It's a good rule, though it usually leads to longer variable names and function names, but not like that is a problem for most people if they have even the most rudimentary editor which can autocomplete names (for example based on the first letter of each function name word. Emacs does a good job at this, but simpler editors work fine too.).

I still tend to write long-winded comments BEFORE I write some code, but those are like mini-design documents where I try to explain to myself and possibly the next reader what is the purpose of some module and how it acomplishes the tasks (if non-trivial, and in a general manner). If such docs are too detailed, they may end up being partially rewritten to conform to the newly written code.

Name: Anonymous 2010-03-29 15:27

I write "assume the reader is an idiot" comments.  Comments before functions or methods explain how they do what they do, with formatted ASCII graphics if need be, and inline comments are limited to explaining what task the following portion of code performs.
If something really breaks into "wait, what did he just do?!" I also highlight that specifically.

Name: Anonymous 2010-03-29 15:43

Please rewrite the fast Fourier transform so that the names and structure make its workings self-explanatory to readers without a formal education.

Name: Anonymous 2010-03-29 16:37

I agree with >>1-kun, although most of my comments are just to make a joke no one will ever read, anyways.

Name: Anonymous 2010-03-29 17:03

>>3
The problem with overcommenting is that you have to update not only your code, but also the comments and documentation. While not a real bug, desynced comments and source code can mislead developers(yourself included, after a few months) which rather undesirable. Desynced source and documentation is a bug because the software does not conform to the spec you wrote for it yourself.

Name: Anonymous 2010-03-29 17:47

>>6
I am also aware of that problem.  For me, however, it is not a "problem" because I really love annotating code.

Name: Anonymous 2010-03-29 20:08

>>7
So, when you get to write real code then Mr. /writer/?

Name: Anonymous 2010-03-29 21:54

>>8
At the start of, in the middle of, and throughout the rest of my projects.

Name: Anonymous 2010-03-30 0:04

Name: Anonymous 2010-11-26 2:45

Name: Anonymous 2010-12-17 1:19

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Name: Anonymous 2010-12-26 6:01

Name: Anonymous 2011-02-03 0:05

Don't change these.
Name: Email:
Entire Thread Thread List