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.
2. Use a mixture of naming styles:
Be secular and celebrate the differences.
3. Don’t comment on your code:
Who’s got time to read that?
4. Write comments in your regional language:
If you decide to violate the above rule, at-least write a comment in your regional language.
5. Use inconsistent formatting styles:
Don’t be racist and be inclusive.
6. Create triangles:
Be like a bird, nest, nest, nest.
7. Fail Silently:
Shh… No body needs to know about the error you caught. No logs, no error modals, chillout.
8. Use global variables:
We are a global entity, so should be our variables.
9. Create variables and functions you are not going to use:
Just in case you need it in future.
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.
11. Use cutting-edge libraries:
You should be up to date with the latest trends, so should be your dependencies.
12. Use flag as the variable name for a boolean:
Naming is hard. Why even think about it?
13. Long functions are better than short ones:
10000 lines of a file are good and 1000 lines of function are great.
14. Don’t write tests:
It’s duplicate and unnecessary work.
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)