DEV Community

Cover image for 14 Tips to write a Bad Code
Pragyan Tripathi
Pragyan Tripathi

Posted on

14 Tips to write a Bad Code

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

2. Use a mixture of naming styles:

Be secular and celebrate the differences.

Image description

3. Don’t comment on your code:

Who’s got time to read that?

Image description

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

5. Use inconsistent formatting styles:

Don’t be racist and be inclusive.

Image description

6. Create triangles:

Be like a bird, nest, nest, nest.

Image description

7. Fail Silently:

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

Image description

8. Use global variables:

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

Image description

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

Just in case you need it in future.

Image description

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

11. Use cutting-edge libraries:

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

Image description

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

Naming is hard. Why even think about it?

Image description

13. Long functions are better than short ones:

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

Image description

14. Don’t write tests:

It’s duplicate and unnecessary work.

Image description

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.

If you want to learn more about DevOps and Backend space, follow me.

If you want to connect, reach out to me on Twitter and LinkedIn.

Top comments (0)