Where’s the comment ?? Oktober 3, 2007
Posted by kunilkuda in Curhat.Tags: coding style;self commenting code;
trackback
O yeah..That’s what’s people always ask me about.
Get realistic kid. You’re programmer, and your job is : <gosh!!> reading the source codes !!
Most of us never really really write codes (not from the scratch, I mean). We’re just read someone else’s source code, and fix it when necessary. That’s how the world run, unless you’re God and have remote control to stop the world..
Hey, no kidding here. You’ve only have 24 hours a day. You’ll need at least 5 hours to sleep, 11 hours for yourself, your family, and your social life, and the rest 8 hours for debugging (hmm…where should I put extra 1 hour for coding ??)..
So, instead of adding comments inside your source code, why not coding your codes into self-comment codes..Something like this :
public void updateSprite(long elapsedTime)
{
float spritePositionX = spriteSpeedX * elapsedTime;
float spritePositionY = spriteSpeedY * elapsedTime;
drawSprite(spriteImage, spritePositionX, spritePositionY);
}
There..no need special comments to understand my code right ??
very interesting. i’m adding in RSS Reader
It’s an old trick. Originate from Code Complete 2.0 – Steve McConnell – Microsoft Press..
Scotia says : I absolutely agree with this !