Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I just noticed, that when I'm coding...
#11
I try and comment my source as much as possible, because although its meaning should be clear from reading the source line by line, other people (or myself later) dont want to read all the source to figure out what is going on. At the very least I have comments at the top of each file and function explaining what its usage is.

Any code that uses hacks or tricks should be commented, because it is often hard (even for the original author) for people to understand its meaning or use at a glance, a single comment fixes all this.

When moving to larger projects, you rely on comments so that everybody knows what is going on with each part of the code without necessarily having to read, this is especially important if you are using methodologies such as design by contract, design patterns or external tools such as Javadoc.

At the other extreme you can go with the infamous comment (original author unknown) "I dont comment my code, If it was hard to write it should be hard to understand".

As for the talking aloud thing, I tend to have a pen and paper handy to scribble with, I draw decision trees and diagrams to represent more complex parts of my code so that I can visualise them.
esus saves.... Passes to Moses, shoots, he scores!
Reply
#12
I always comment. I mean, why not? And trust me, after you've left a project alone for a few month's you too will forget some of the stuff it does and have to sit there working out the code in your head. Commenting allows you to save some time so do it! Don't be lazy like Ninkazu Tongue
Reply
#13
yeah, when I dim the vars, I put them in categories and comment each category.

Also I comment some blocks of code as if each had been a sub (add a name), since I don't make the sub if I use it only once.

Otherwise, my l34t hax0ring pr0gramming is very easy to read...

Besides, I found out that commenting and indenting and stuff usually just makes it harder to understand.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#14
Commenting and indenting make it easier to read code Tongue

Indenting is fine, I use it too. Commenting doesn't make it harder to read, just a pain in the ass to sort through the comments and the actual code. Whenever someone writes code that I'm trying to understand, and if they comment, I usually read it through the first time, then delete it and try to understand it as code.

See, it's easier for me to understand logic in my head than it is to decypher people's perception of logic. Perhaps this is why I'm so brilliant?
earn.
Reply
#15
Quote:Besides, I found out that commenting and indenting and stuff usually just makes it harder to understand.

Huh?
Reply
#16
I comment my code only when I don't know what I am coding exactly, that is, when the algorithm is new to me, or if this is very complex to do it straightforward. It is more like a matter of organizarion. Sometimes I just put a DO and a LOOP and in between I make comments with the different things I have to do for that loop to work, and then I fill in the blankets.

Commenting is a good practice. We all know that people like Ninkazu are more intelligent that we, simple mortals, so they don't need to comment. But I do need. For example, I am working in a project since 1 year ago. Usually I code for 1-2 days and I have delays of months. If I didn't comment, I didn't know what the heck is going in the damned code Tongue

But who cares... I'm a pothead, maybe it is the reason why I comment Tongue
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#17
Quote:I always comment. I mean, why not? And trust me, after you've left a project alone for a few month's you too will forget some of the stuff it does and have to sit there working out the code in your head. Commenting allows you to save some time so do it! Don't be lazy like Ninkazu Tongue

My comments are world renowned for their strangeness, but I think Qbasic code is basically self-documenting. Unlike C, where you can have like a hundred abstract symbols in a row, QB is basically english, so as long as you understand the concepts in use(which is easy with modular, well written code)...
Reply
#18
I comment most of my obscure code. I wouldn't be able to make sense of FJ's code Had I not commented it. :*)

More so with RelLib. ;*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#19
Ah, potheads :roll: . You people amuse me Wink
PS. Is "2050" a title you get with 15 posts or something? 'cause I just got it.
In a race between a rock and a pig, don't varnish your clams." -- "Dilbert"
Reply
#20
I used to comment. Then I realized it's a drag and gave up on that.

I kinda rush a lot when coding. You know, I want to see right away how the stuff I've just coded works and right after testing one thing I start coding another thing. All that creates small devious bugs which are hard to notice. I would probably notice them if I coded with more care.

I like to declare long discriptive SUB names like InitiateExplosion. Maybe that's not such a long name for a sub.Lemme see... Ah yes, Engine.ProjectileCollision.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)