What's the worst coding practices you have seen(or done!)?

No Offence, each one of us must have either seen or (mostly) done/followed some Coding Practices that we are not so proud of 😆.

Let's be honest here and post what are those. It would be great to see those with some examples, if possible!

To start with me, so far most horrible coding practice I had in two places:

  • Loops : I have written for loops that are nested to 4 levels with iterate variable named as, i, j, k, l etc.. When I look back, damm 😬!
  • Logical Conditions: &&, ||, ! with if-else. I have really done blunders in past where I wrote some if-else along with && and || that finally sounded very illogical and had to re-factor.

As Programmers, everyday is a new day with a new learning. I have learned too from my horrible programming practice mistakes. Still learning!

Let us know yours. 😄

Write your answer…

11 answers

A function that loops all of the array of objects, then inside of it has also a check if the current iteration of that loop is an array or object, if it's an array it will recursively run itself again, and returns nothing. Imagine you have hundred thousands of data / object that is being passed from that function and it returns nothing, no mutation at all.


Reply to this…

Share your programming knowledge and learn from the best developers on Hashnode

Get started

I want to pinpoint one project, where I would say that I have never seen the worst coding practices anywhere else.

  1. Using scoped styles in every component
  2. Using a JS framework along with defining custom components (like: buttons and labels)
  3. Not using ESLint or any other linting tool
  4. Spacing and tabs mixed together
  5. Not removing old/unused code

Not using linter is bad...However using the linter and disabling the rules in code lines is kinda crime!

Reply to this…

More of a deployment/version control thing but I've seen people version control the code and then just copy the files to test + staging servers LOL. I've done a couple of bad things in the past but nothing quite like that.

That's probably the worst I've come across.

Reply to this…

I also experienced some bad coding standard ..

a. Very convenient way to declare global variable into program -- Memory leak issue . b. Use ForEach loop like a bread & Jam -- Performance issue c. Always ready to implement everything in UI layer rather then think twice and move to right place . d. Use proper design for implementation , It can avoid lot of bad practice .

Still Counting :)

Reply to this…

Boy... I don't know where to begin. I've broken just about every rule in the book. My main problem i think is I find I use if statements without the else a lot. Like I will do this:

foo = 300

if foo == 200:
    print("foo is equal to 200")
if foo is != 200:
    print("foo is not 200")

I could of easily used an else there, it also looks extremely messy.

I name my variables ridiculous names.

I just give them names off the top of my head.... I'm trying to break that habit but I will literally use "foo" as a variable name if I can't think of anything.

If I listed everything else, I would go on all day. ;D

Often I find myself naming variables too long...Then when try to short them, the meaning will be lost and back to square one!

Reply to this…

Load more responses