14 Tips to write a Bad Code
Tags: codenewbie, programming, coding, devjournal
Published: 2023-05-24 01:32:00

Ever wondered, what a Bad Code looks like? 

14 Tips to write a Bad Code:

## 1. Use obfuscated variable names:

Fewer keystrokes, more time for you.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qwmt5jroawyshxvujid6.png)


## 2. Use a mixture of naming styles:

Be secular and celebrate the differences.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qdazifkvirujq6gnn7v8.png)


## 3. Don’t comment on your code:

Who’s got time to read that?


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/13lw6yvplqyf1p7b8v6b.png)


## 4. Write comments in your regional language:

If you decide to violate the above rule, at-least write a comment in your regional language.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6f6ntkqsk7rcs87yqtle.png)


## 5. Use inconsistent formatting styles:

Don’t be racist and be inclusive.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e0cy166xlcikuomecd50.png)


## 6. Create triangles:

Be like a bird, nest, nest, nest.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5kqfz27qy774bq9chu3c.png)


## 7.  Fail Silently:

Shh… No body needs to know about the error you caught. No logs, no error modals, chillout.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qyze1v6hobf9hhynt43f.png)


## 8. Use global variables:

We are a global entity, so should be our variables.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l2ma8bdc3tw0gctuwhzp.png)


## 9. Create variables and functions you are not going to use:

Just in case you need it in future.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hb5dan29e5pp0kvvx9mw.png)


## 10. Do not indent your code:

Indentation makes complex code take up more space in the editor. If you can’t avoid them, just mess with them.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g7kcmr7igh93yzrmxl16.png)


## 11. Use cutting-edge libraries:

You should be up to date with the latest trends, so should be your dependencies.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/07rhlqk1g8luqsifj1ba.png)


## 12. Use flag as the variable name for a boolean:

Naming is hard. Why even think about it?


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9j6shb6w2dh28ausxk9a.png)


## 13. Long functions are better than short ones:

10000 lines of a file are good and 1000 lines of function are great.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6iy3zm6ms6hs08jr4hr1.png)


## 14. Don’t write tests:

It’s duplicate and unnecessary work.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fd7u6ixu1ll9zttl9tax.png)

I hope you would have learnt what bad code looks like. Make sure to avoid them to be good at programming.

Thanks for reading this.

If you have an idea and want to build your product around it, schedule a call with [me](https://calendly.com/pragyanatvade).

If you want to learn more about DevOps and Backend space, [follow me](https://dev.to/pragyanatvade).

If you want to connect, reach out to me on [Twitter](https://twitter.com/pragyanatvade) and [LinkedIn](https://www.linkedin.com/in/pragyanatvade/).