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
-
I love the idea, but it's fantasy land. "Obvious" is completely subjective and commercial pressures nigh on always guarantee hacks and rushed commits coming up to deadlines. It's just the way it is.
To me it seems like a false economy to save time writing comments but instead introducing technical debt striving for some "ideal world" scenario. -
I use to write the name of functions and variable like this post_a_comment_on_devrant all done
-
Xmiq1078ythe only comments worth making is to explain the finer logical details that you can't glean a first glance
-
ryuu278y@samk the point of not commenting is not to earn time. Comments are dead, and code lives. Sometimes people forget to update comments when they change something in a function, and there the comment will make the code even harder to understand! This kind of things won't happen if you write really litteral code, cause if you change the code, well the previous one isn't there anymore to mislead you :)
-
@ryuu That's a fair point. But I guess I'd argue that's a function of code review (make sure comments reflect code).
You also can't guarantee a level of knowledge and ability across your team. Comments can be educational in this context. Not everyone may be capable of structuring code precisely or may not know every element of syntax in a given language.
I know I'm a dinosaur on this subject and the contemporary, agile way is to minimise the need, but I still advocate commenting of code. -
ryuu278y@samk your arguments have their weight too :) I guess it depends a lot on your team and personal tastes too. Both views have pros and cons. I have a co-worker who has the same viewpoint as you and he's often ranting about how I split my code in too many functions (which I do to express in words what my code does) instead of just putting a simple comment.
-
@ryuu I hope I don't come across as ranting about this! 😝 I also would not, in any way, discourage anyone from splitting code into multiple, small functions - and absolutely no way would I use good comments as a justification for writing unnecessarily complex code.
forget comments! write self documenting code that's obvious to anyone reading the system.
undefined