We all have coding habits that we know we need to break - from not documenting code properly, not using version control, or hardcoding values instead of using variables or constants. 👀
Confess: what are your worst coding habits? And how do you overcome them?
Join the conversation and follow the DEV Team for more thought-provoking discussions!
Image by macrovector on Freepik
Top comments (12)
Writing code without proper documentation makes it harder for other developers to understand and maintain your code.Hard-coding values in your code, instead of using constants or configuration Couple of the Day files, makes your code less flexible and harder to maintain.
I'm doing to much refactoring making the code seem "beautiful".
Sometimes I try to prematurely optimize.
My git commits are horrible. I do
git commit -am "stuff"
so often I should make an alias for it. I justify this by telling myself it doesn't matter because I'm just going to squash them when I merge them anyway, and can give the squash commit a good message.Sometimes spending too long coding a quick bespoke func only to realise the language often has it covered in the stdlib already, or even 1-2 built-in methods I can chain. I was just in too much of a rush to RTFM!
Well might sound weird, but probably being silent. Sometimes i go into my own world and just code, and forget to update the team. But when you are working in the team, they need to know what is happening. Solution: Sticky note on the screen to remind myself to update everyone one the status and decisions :)
I often try to make things more catchy, sometimes basic and clean is the best choice. Like for example I made this button to recreate a discord animation, it was fun but maybe not necessary 😅
git status
on every change 🤷I get so excited about niche ways to do things concisely, I end up looking at them later and having to spend many seconds to figure out what it's even doing 😅 and considering it's my own code, I'm willing to bet other people (especially beginners) would have an even harder time
I've gotten better about this lately, but it's still a lot of fun so it's hard to convince myself not to do it
I think it's not worst!... cz am coding while dancing! 😎