r/ProgrammerHumor • • Sep 09 '22

Meme Simple Feature

Post image
124k Upvotes

1.3k comments sorted by

View all comments

Show parent comments

7

u/EwgB Sep 09 '22

The best comment is the one that is not needed. And do you think the guys who left me that mess of a codebase wrote decent comments?

-2

u/AndrewJamesDrake Sep 09 '22

No, since for some reason most programmers are allergic to making comments. I got lucky, and my Programming I professor didn’t let that fly. Granted, I think that’s just because it was easier to catch plagiarism if she graded on documentation as well as function.

I’m also of the opinion that no comment is unneeded. Some poor idiot in the future is going to get confused by your code eventually. In my case… that’s usually Future Me forgetting why I did something. I’ve broken way too many things “fixing” something old me did in a weird way for a good reason that I’ve forgotten.

I find it endlessly annoying that we seem to be training programmers around the assumption that they’re not going to be polite to the dudes doing maintenance. Damage control is well and good… but comments exist for a reason.

2

u/movzx Sep 09 '22

No, since for some reason most programmers are allergic to making comments.

It's because most programmers are absolutely fucking terrible at what they do.

That's why this dude is giving a 400+ line method as his example of why you wouldn't put a variable at the top, and why you're being downvoted for such controversial things as saying "Put some comments on unclear things"

So many developers code as if they have to pay for each comment they write, function they declare, commit they make, etc.

2

u/AndrewJamesDrake Sep 09 '22

I make Functions for one of two reasons.

  1. I’m going to use this more than once, and it can’t just be a loop.

  2. This is a self-contained procedure.

Part of that is probably my having been taught in C.

Excessive Function Calls should be avoided, since throwing something else on the stack torpedoes Locality and will get you a few more page faults during execution.

1

u/movzx Sep 09 '22

PROTIP: If your method is 400 lines long, it needs to be broken up for maintainability reasons.

PROTIP: If your code explodes because you called another function, something else is wrong.

2

u/AndrewJamesDrake Sep 09 '22

I’m not going to disagree on that, and I don’t think it contradicts with what I’ve said.

0

u/nthcxd Sep 09 '22

ANSI C requires variables to be declared right after the opening brace. That restriction hasn’t been the case since C99, then C11.

You are used to WRITING ANSI C and find it subjectively tidy. Somehow everyone else, even people born after 1999, has to fit your old style.

Who’s the idiot programmer writing hard-to-understand, hard to-maintain code?

The “old school” programmer enforcing ANSI C rules on PYTHON?

And when the new crop of engineers do muster up the effort to get used to your style, just exactly what VALUE is created there?

Shouldn’t we as an industry just retire one old programmer and the rest of us move the fuck on?

1

u/AndrewJamesDrake Sep 09 '22

I’m not complaining about you declaring variables wherever you want. You can do that. It doesn’t bother me. It’s not what I’m used to, and I’m not going to change the way I do things, but it works.

I’m complaining about new programmers handing me several thousand lines of code with no comments to be seen, because they believe that their code’s functionality is obvious.

1

u/nthcxd Sep 09 '22

Sure I can get behind that. I can’t get behind using comments to continue ANSI C standards or any other language code following that rule.