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

5

u/sus-is-sus Mar 23 '22

your example is just a method that does too much. it should be broken down to methods that only do one thing. runPricing, Cache, Save, Log.

1

u/vi_sucks Mar 23 '22

Ok, so when you need to run this same logic in 50 different places innthe application, you'll just copy and paste those four method calls everywhere?

No. You will create a wrapper method. And then you need to name the wrapper method. If you name it something that describes exactly what it does, because you don't have a comment to explain a shorthand, you end up with the above.

1

u/sus-is-sus Mar 23 '22

i have seen wrapper happy code. it is hot garbage.