Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Kgd-836yA 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. -
inaba46256yMost 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
// todo -
Sayaka11026yBetter 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.
Related Rants
"For every 3 LOC, you should write a comment. It's a standard." - A professor
Is it? 🤔
question
comments
i don't know