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 mean if you want to remove comments it’s a simple find and replace with regex probably
-
@supernova777 I agree - at least they give some sort of effort to make it readable
-
scor33111yChance is the current des just state it were the previous ones, but in fact it was them.
-
hjk10156961y@supernova777 @shovethisrant when they are all over the place it really does harm. It's like trying to do a sudoku with a toddler giving you a constant stream of helpful things like "that's a seven, I like sevens, whooo line line line, you can draw a duck with seven" mixed in with complete nonsense like toddlers do. Because you know what, who the fuck is going to maintain all these comments when the code changes?
No comments are bad. You want some documentation of the API and self documenting code is a myth. Over doing it can be just as bad. -
@hjk101 I really think that mentality is over dramatic and elitist. Just delete the comment if you don’t like it lol. It’s not that hard
-
Comments are only good when they are maintained.
Unmaintaned comments are usually the source for "i stepped on a claymore and I'm not feeling well" debugging.
Thus: Only comment if necessary. Redundant comments are just additional maintenance work. -
alturnativ630356dI kind of agree, but rather think that the code should be as self-documenting as possible. Wherever you might feel the need to write a comment... Chances are you can abstract that block of code into a method with that comment as its name.
In this case it's a bit of an extreme example, but I'd either abstract the whole block of code into a method like Validate(thingies); or at least abstract the condition in the if-statement to something like AreValid(thingies) or CanValidate(thingies). -
alturnativ630356dI also realised with the last part of my previous post that even with the code comment it's less clear what is happening than if the code was written the way I described - right now I can't tell whether the comment is saying that the condition in the if-statement is validating thingies, or if the code block following the condition is what performs the validation. It's probably the latter, but could go either way imo 🤷🏻♂️
I want to slap the previous devs on my team. Not the current ones, the previous once.
I don't need a comment on every. single. line. of. code
//verify thingies
if(thingies != null && thingies.count != 0) {
Like my god, i can read the if statement to know what it's doing, goddamn.
Comments should only be used when doing something that might not be immediately obvious to the next dev looking at the code.
rant