The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => The Orphanage => Topic started by: Gunner on November 21, 2009, 06:19:45 AM

Title: I'm a dumbass for not commenting my code!
Post by: Gunner on November 21, 2009, 06:19:45 AM
don't agree with me  :wink  Man, I aways commented my code very well, even to the point of over commenting (figured I can go back anytime and know what that line did).  I gotten lazy and commented my code less and in some spots none at all.  Well, went to work on a project I started a few years ago and one that I got lazy with commenting and I don't know what the hell is going on!  Me of all people hard coded an error value in a check of eax and had to search high and low to find the meaning... even simple code I forgot what it meant or does after a few years of not seeing it.....  I LEARNED MY LESSON and A LESSON TO BE LEARNED BY ALL.......  COMMENT YOUR CODE no matter how simple it may seem at the time!
Title: Re: I'm a dumbass for not commenting my code!
Post by: hutch-- on November 21, 2009, 08:55:39 AM
 :bg

Muhahahaha, haven't we all. I am just rewriting some 10 to 12 year old tools of mine and I was only about half way to documenting my code properly that long ago. It comes back and haunts you every time.
Title: Re: I'm a dumbass for not commenting my code!
Post by: jj2007 on November 21, 2009, 11:41:10 AM
Yeah, it requires a lot of discipline. The worst case is other people's code. The second worst case is own scarcely commented and "organically grown" code in a 10,000 lines source. The only thing that helps in such a case is a comfortable search function that yields a listbox and includes a NEAR feature. For GFA Basic, I wrote that feature many years ago, and could not live without. This one says find ColPen& NEAR PS_SOLID:
(http://www.webalice.it/jj2006/pics/Gfw_List.png)

Same for assembler:
(http://www.webalice.it/jj2006/pics/MasmBasic.png)

Of course, properly commented code would be even better. But that is theory. Practice is being lost and yelling for help :8)
Title: Re: I'm a dumbass for not commenting my code!
Post by: dedndave on November 21, 2009, 12:08:03 PM
we have all done it - and it is, of course, good to comment your code
however, sometimes you write simple trivials to do something one time
i think there is something to be said for writing code fast and furious
it is a little bit like playing speed-chess to sharpen your game
Title: Re: I'm a dumbass for not commenting my code!
Post by: oex on November 21, 2009, 02:14:47 PM
; Dont forget how you did this
Title: Re: I'm a dumbass for not commenting my code!
Post by: Gunner on November 21, 2009, 03:03:29 PM
Eh, I started to re-write the code and am figuring it out.  My dreams started with a semi-colon last night  :bg