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:
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. 😄
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.
I want to pinpoint one project, where I would say that I have never seen the worst coding practices anywhere else.
- Using scoped styles in every component
- Using a JS framework along with defining custom components (like: buttons and labels)
- Not using ESLint or any other linting tool
- Spacing and tabs mixed together
- Not removing old/unused code
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 :)
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