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

// This is a thread about comments in C code

Name: Anonymous 2013-07-21 0:02

So, I've always been pretty bad at properly commenting my code. It has mostly been an utter mess without any structure or distinguishable style whatsoever.
Then a few weeks ago a project of mine was starting to get pretty big, and I started to notice that there was no way I was going to be able to maintain or edit the code unless I started structuring it better.
And so I started commenting. At first it was great. My code was readable and very easy to recognize and edit as needed. I was loving it, and looking back at my old code, I couldn't believe how I could have lived without such structure and readability.
But as the code grew, so did my desire to comment. Soon commenting once every 5-10 lines didn't do it for me anymore. I needed more, and so the comments grew longer and more frequent. Before I realized it my code had become nothing but a big grey text document with an occasional C stament thrown in here and there.
It wasn't until I looked back and saw the following line that I realized I needed help;
    // Take a number which is five and then add it to another number which is also five and then assign it to the variable that is named FiveAndFiveTogetherEqualsTheValueOfThisVariableWhichIsOfTypeInt which is of type int.
FiveAndFiveTogetherEqualsTheValueOfThisVariableWhichIsOfTypeInt = 5 + 5;
The code is slightly dramatized.
There are overly verbose (compare http://www.youtube.com/watch?v=wz_K1Gjrx8c) comments at least once every other line, sometimes spanning multiple lines, which are now having the opposite of intended effect on the readability of the code, and slowing me down quite heavily.
I've tried to restrain myself, but I just don't have the mental force or self-control to do it. I think I will have to refrain from coding at all for a while.
Does anyone have any similar experiences, or advice? Any help would be greatly appreciated.

Name: Anonymous 2013-07-21 1:09

/* FUK U */

Name: Anonymous 2013-07-21 1:47

Slow down while writing code.  Restrict your variable names to six (or something similar) characters. Only allow yourself one comment per function, placed at the top.  Temporarily change your tabbing to 8 characters and enforce an 80-char limit. You already have the instincts to make code readable, so this will have the effect of forcing you to be concise, rather than making your code completely unreadable

Name: Anonymous 2013-07-21 2:02

Restrict your variable names to six (or something similar) characters.
No.

Name: Anonymous 2013-07-21 2:03

>>4
Yes.

Name: Anonymous 2013-07-21 2:56

Code usng abrv vari nams can be hard to read when the abvs have ambg mnin.

Name: Anonymous 2013-07-21 3:03

>>6
No shit. That's why you need to learn how to name them so that their intent and usage is clear.

(See what I did there? The same thing you did.)

Name: Anonymous 2013-07-21 3:32

>>7
neat. That reminds me of the defining everything from small words speech I read once. I think it was about scheme.

Name: Anonymous 2013-07-21 3:59

Learn you a Haskell for GREAT Good!

Name: Anonymous 2013-07-21 8:22

>>8
No, is was about CL you fucking book-burning philistine, the Great Quux (pbuh) did it. Read a fucking book for once in your lifeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHHHHH

Name: Anonymous 2013-07-21 9:28

Name: Anonymous 2013-07-21 9:33

/\
* Block comments for the win
*/

Name: Anonymous 2013-07-21 9:33

/\
* Block comments for the win
*/

Name: Anonymous 2013-07-21 13:53

>>8

you have a link?

Name: Anonymous 2013-07-21 15:22

>>10
I'm pretty sure it wasn't CL. It was about the value of minimal languages, which CL is not.

>>14
Nope.

Name: Anonymous 2013-07-21 18:45


/*
<!-- YOLO -->
*/

Name: Anonymous 2013-07-22 0:12

>>16
/*
(*
<!--
# ; // Gotta catch 'em all
-->
*)
*/

Name: OP 2013-07-22 0:33

Thanks for the advice, friends. I'm feeling a lot better now. I've taken a pause on the big thing to continue with some smaller quickie projects instead. The need for strictness and structure is not as big, which is nice. The code I'm writing is clumsy, slow, messy, and absolutely wonderful. I feel like I can just do my own thing again. Hopefully I'll learn from this experience and be able to reach some kind of sweetspot. And if I were to unwantedly slip too far off in any direction, I know what I can do to get back.

Name: Anonymous 2013-07-22 5:12

Write simple, clear code. That will drastically reduce the need for comments.

Name: Anonymous 2013-07-22 5:31

>> //
comments in C
/* No.  Fuk u. */

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