r/learnprogramming • • Mar 22 '22

Don't be that guy.

I just took over a project for a guy who left. Don't be this guy:

  • ZERO comments in your codebase.

  • One and two character variable names with no discernable pattern.

  • Comment characters used to comment out big chunks of code for no discernable reason.

  • No error checking.

  • Reliance on data files that you forgot to include or explain, going in to meaningless data frame names.

  • Making outrageous claims about how much your code improves things with zero baseline performance.

People like this think you're an idiot because you can't make their code work, and get to be all smug. We will track you down and find you. You will need references someday....oh my.

2.6k Upvotes

427 comments sorted by

View all comments

Show parent comments

11

u/Inderpreet1147 Mar 22 '22

If people don't update comments while updating code, that's on them and the reviewer honestly

1

u/OddBet475 Mar 22 '22

Not really man, you are thinking small where you have a realm of control. It can be so easy, have you ever seen a massive corporate code base?

5

u/Inderpreet1147 Mar 22 '22

I have, but imo I've found modules with some partially accurate comments are far easier to grasp than module with no comments.

2

u/OddBet475 Mar 22 '22

That's a good company then, we have many million lines of code and some comments you come across are 20 years old written by folk that English was not their first language. Debugging through 50+ service programs and such to find a bug and fix it you don't note the comments down on your travels that need correction (you don't even read them tbh).

1

u/psioniclizard Mar 23 '22

If you have a good review process, half the issues people have brought up here in favour of commenting everything would not he issues. Which is what you should be moving towards anyway.

I don't think anyone is saying don't comment code, they are say it is not a perfect solution and there are often better ones.

Put it this way, everyone who is saying "it should be commented" are assuming the comments will actually be good. That is not really any different than saying "it should of been written in a better, more understandable way originally" both of them rely on the idea that something in the past should if been different. But you can't change the past.