Code Comments

They are as they sound - comments on code. Or more importantly - comments in code. Code comments are a syntax that allows you to write plain English (or your language) within your code.

These are incredibly useful for explaining to others (and often yourself) what your code does or what you hope it does. As you’ll notice in my Java Course, I’ve used code comments extensively to explain what each line does.

On the flip side of this, a lot of developers believe code comments are a sign of bad code. They feel that code should be readable in its own right and not need a lot of extra help to understand it. They feel that if the code isn’t readable, no comments will save it

Aside from that, it’s important to know the option is there to add comments.

Some use them for humour, here are some good ones from this awesome thread on stackoverflow.

//
// Dear maintainer:
//
// Once you are done trying to 'optimize' this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
//
// total_hours_wasted_here = 42
//
// I dedicate all this code, all my work, to my wife, Darlene, who will
// have to support me and our three children and the dog once it gets
// released into the public.
// drunk, will fix later