Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
grayfox37503yIt might be a standard in his/her class. And it would be a really shitty one.
Kgd-843yA little common sense goes a long way.
If you ever have the feeling that something you've written is slightly more complex, you should probably leave some comments.
Basic "1 step" functions on the other hand get commented by themselves if you just name them properly.
inaba48703yMost definitely not unless you want to have comments telling people that a bridge is a bridge rather than telling people where said bridge goes to
// Express your disapproval.
I don't agree with your professor.
Commenting for the sake of commenting is silly.
Only add comments when really needed.
// Talk about Uncle Bob
I like Robert Martin's take on comments.
He feels that comments should be limited.
If the code isn't clear, then that's code smell.
// Continue talking about Uncle Bob
If your code does not express it's intent,
you should try rewriting it. If possible,
code should be self documenting.
// Finish strong
//this code has way too many fucking comments.
//yeah I know.
Sayaka11383yBetter than being asked to comment every line
//This empty line serves as some visual spacing between different sections of code. Unfortunately this comment has now disrupted the spacing, rendering it useless.
//obligatory comment - initialize things
Def __init__(a, b):
Self.a = a
Self.b = b
Yea. Definitely helps a lot. I'd be lost without it.