Thread 105681264 - /g/ [Archived: 805 hours ago]

Anonymous
6/23/2025, 5:29:27 PM No.105681264
images (85)
images (85)
md5: c2d01025abbd90e33d50d430f7a6d298🔍
My boss used to say comments are bullshit because they waste time and code should be readable by itself. Is this retarded
Replies: >>105681577 >>105681664 >>105681675 >>105681714 >>105682081 >>105682091 >>105682627 >>105683034 >>105683244 >>105683693 >>105684625
Anonymous
6/23/2025, 6:06:30 PM No.105681554
>x * 1.4938374
is a simple line but do you understand what it does and why because its simple? Some lines need explanation some don't
Replies: >>105681647 >>105683344
Anonymous
6/23/2025, 6:09:23 PM No.105681577
>>105681264 (OP)
No, its the correct way to code.
If you can't read code/know what it does based on reading it in context, you're a shit programmer.
Anonymous
6/23/2025, 6:18:45 PM No.105681647
>>105681554
I hope you are being sarcastic
Replies: >>105682962 >>105683001
Anonymous
6/23/2025, 6:20:47 PM No.105681664
>>105681264 (OP)
Why would you read a vague description of something, in the hopes that it's still up-to-date...when you could just read the very thing it's describing?
Comments are teh suck.
Anonymous
6/23/2025, 6:22:28 PM No.105681675
>>105681264 (OP)
comments are for why a piece of code is there not what it is or how it works. if it's obvious, no comment needed
Replies: >>105681681
Anonymous
6/23/2025, 6:23:14 PM No.105681681
>>105681675
/thread
Anonymous
6/23/2025, 6:25:54 PM No.105681714
>>105681264 (OP)
The strongest argument against comments is they tend to lag.
Surely you have seen READMEs and documentations and manpages that don’t actually match the current behaviour of a software. Same thing with comments.
Replies: >>105682146 >>105682239
Anonymous
6/23/2025, 6:47:51 PM No.105681908
yes, but if you don't have comments, then it means that variable and function names must act as comments.

this is problematic because in order to replace comments you need to refactor pieces of long functions into smaller functions, and function composition in languages like C/C++ has associated cost (like manual error handling boilerplate, for example).

this is why boomer programmers throw a tantrum over clean code.
Replies: >>105681974 >>105682080 >>105682106
Anonymous
6/23/2025, 6:56:04 PM No.105681974
>>105681908
>Throw a tantrum over clean code
Yeah God forbid the code is readable
Replies: >>105681985
Anonymous
6/23/2025, 6:57:54 PM No.105681985
>>105681974
No comment is a critical code smell.
Replies: >>105682024
Anonymous
6/23/2025, 7:02:59 PM No.105682024
>>105681985
All code is critical
Anonymous
6/23/2025, 7:05:33 PM No.105682044
There are lines of codes that are too ambiguous and a comments helps a lot.
Also, with llms generating code, it helps them think, so now I don't remove the comments they add on parts of code that are meant to be automatically maintained by consulting llms, if it's just a snippet for my own manual code I usually remove the comments unless they're needed/fitting according to me.
But yeah a lot of comments feel like extra content that just bloat the code.
Anonymous
6/23/2025, 7:10:16 PM No.105682080
Yes and like >>105681908 says
Have fun writing incredibly verbose variable and function names

Show him doxygen. The comments can be helpful and descriptive AND it automatically generates documentation, hitting two birds with one stone.
Anonymous
6/23/2025, 7:10:18 PM No.105682081
>>105681264 (OP)
Comments should be the exception not the rule.

Any time your code does something unexpected there should be a comment to draw attention to it and explain what the fuck is going on.

But 99% of your code is probably very straightforward.
There should be no comments there as they would only state the obvious and make the important comments stand out less.

Just think about the boy who cried wolf.
Anonymous
6/23/2025, 7:11:48 PM No.105682091
>>105681264 (OP)
Sometimes the problem domain is retarded, and hence necessitates retarded code. Retarded code needs comments to be understood.
Most code should not need comments. If it does, either you're working with retards, or you are the retard.
Anonymous
6/23/2025, 7:13:44 PM No.105682106
>>105681908
Boomers used short variable names because they had like 32 kilobytes to store their entire program including variable names and comments in.

Modern computers with gigabytes of RAM don't have this problem.
Anonymous
6/23/2025, 7:20:23 PM No.105682146
>>105681714
this is only really the case if comments are describing what the code does instead of its intent; the former is pointless because you can just read the code, whereas the latter is useful because you can use it to determine if the code is satisfying the business need it claims
Replies: >>105682207 >>105682289
Anonymous
6/23/2025, 7:27:05 PM No.105682195
I document everything I write and do in IT cause I got so old I forget what I did or wrote 2 weeks ago. I remember working on some program but what I did exactly is gone in 2 weeks.

So yeah man comment your code, your reasoning atm and screenshot hard to find stuff.. Thank me later.
Anonymous
6/23/2025, 7:28:04 PM No.105682199
If you don't write documentation, no one will build on top of it. Might be a good deterrent.
Anonymous
6/23/2025, 7:28:51 PM No.105682207
>>105682146
That doesn’t make sense. Are you legitimately retarded?
Replies: >>105682272
Anonymous
6/23/2025, 7:34:00 PM No.105682239
>>105681714
Comments lag way less than READMEs or doc pages. It's probably a better idea to generate your documentation from code comments whenever possible, as people are more likely to change comments next to things than switch over to a separate documetation file.
Anonymous
6/23/2025, 7:38:18 PM No.105682272
>>105682207
lil bro, read it again. but with your brain turned on this time.
Anonymous
6/23/2025, 7:41:58 PM No.105682289
>>105682146
>you can just read the code
i can read german, it doesn't mean I understand it
Replies: >>105682730
Anonymous
6/23/2025, 7:47:53 PM No.105682325
He has a point, but you should at least comment what the output is and what will call it, if for no other reason than to keep yourself from needing to go hunting later on
Anonymous
6/23/2025, 8:23:32 PM No.105682627
>>105681264 (OP)
No, it's smart. Code should be self-explanatory if possible and in most cases it's very possible.
Just use meaningful names for variables and methods as documentation.
However there may be cases where you need to add context as to why something is the way it's done.

Apart from being unnecessary in most cases comments also create work and confusion.
They have to be changed when the code is changed. That's extra effort.
It can also easily be missed since the compiler doesn't care about comments and you don't get errors.
In the worst case you have comments that contradict the code.
Anonymous
6/23/2025, 8:35:30 PM No.105682730
>>105682289
then don't write german, dumbass.
Anonymous
6/23/2025, 9:00:26 PM No.105682962
>>105681647
he clearly isn't because he is right
Anonymous
6/23/2025, 9:03:49 PM No.105683001
>>105681647
>What is a constant for 500 Alex
Anonymous
6/23/2025, 9:07:27 PM No.105683034
>>105681264 (OP)
If only based thinking as your boss' was more common, we probably would not have p*thon
>use triple nested list comprehension, bro
>IT'S MORE PYTHONIC
Anonymous
6/23/2025, 9:10:42 PM No.105683070
It depends on context??? If it's an idiom that every single professional C programmer or whatever knows, then no, it doesn't need to be commented. if it's clearly obvious what you're doing then you obviously don't need to comment it do you?

If you're doing something tricky or obscure, sharing between files, calling something obscure in the codebase, then yeah it should probably be commented.

brief comments before non-idiomatic blocks is literally the standard anyway, especially with shared data, your boss is retarded for making sweeping generalizations, but this is common for autistic midwit codemonkeys.
Anonymous
6/23/2025, 9:35:59 PM No.105683244
>>105681264 (OP)
Your boss is a morron and he never wrote a line of code. Good luck making changes to a project or debbiging code after an employee leaves or after not working on that code for a while.
Anonymous
6/23/2025, 9:47:19 PM No.105683344
>>105681554
I would wonder why 1.4938374 in particular. How do I know it should not be 1.4938379?
Anonymous
6/23/2025, 10:27:04 PM No.105683693
>>105681264 (OP)
your boss is a double nigger
code can never be self-documenting, because it only describes what the software currently does and not what it's supposed to do
Anonymous
6/24/2025, 12:31:20 AM No.105684625
>>105681264 (OP)
This was basically policy at Meta. Comments would get shredded in code review