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

2

u/saintpetejackboy Mar 23 '22

Yeah, I went through this phase, too. I think it is common when you start out. I tried to get all philosophical and shit with my variable names and it is just a waste of time. My current trend is just unsetting a variable or reducing it to zero and using the same variable name I used elsewhere if it describes the same thing in a different context. I don't really recommend doing this, but it helps in a procedural context to maintain consistency and deliberately check the value of a variable in numerous places. I have already kicked my own self in the ass a few times over it when it caused some problems, so I will probably try to break the habit during my current project.

2

u/vi_sucks Mar 23 '22

My current trend is just unsetting a variable or reducing it to zero and using the same variable name I used elsewhere if it describes the same thing in a different context.

Oh god, don't do this professionally. That's a nightmare of horrible and impossible ro reproduce bugs waiting to happen.

1

u/saintpetejackboy Mar 23 '22

My current project doesn't do this (yet), but I do reuse similar variable names within the scope of functions a few times when it probably could have been avoided, probably a couple of times I pass some kind of ambitious variable names off, but nothing too atrocious haha.