loading...

What are your worst coding habits?

ben profile image Ben Halpern ・1 min read

Is it bad commit messages, getting distracted by social media, commenting out tests?

Let’s hear it all.

Discussion

pic
Editor guide
Collapse
selbekk profile image
selbekk

I write git status at least 4000 times a day, for no reason whatsoever.

Collapse
learnbyexample profile image
Sundeep

how about ls and clear

Collapse
huyduy profile image
Huy Duy

You can use Ctrl + L instead.

Collapse
titivermeesch profile image
PlayBossWar

Doing this all day long when I'm working for no reason, I don't know why actually

Collapse
jcoelho profile image
José Coelho

Yep that's me. I even write git status after committing just to make sure 😅

Collapse
chin98edwin profile image
chin98edwin

And also git branch after git checkout just to make sure I'm on the right branch… 😂

Thread Thread
kaddkaka profile image
kaddkaka

My prompt reflects which branch I'm on, super helpful!

Collapse
learnbyexample profile image
Sundeep

That has actually helped me once, I'd forgotten to git add some files

Collapse
glaaki profile image
Sean Porter

at least alias it to gst!

also: me too

Collapse
cjbrooks12 profile image
Casey Brooks

With as much as I check git status, I don't have time for a 3-letter alias! gs is all I can afford 😜

Thread Thread
a0s profile image
Anton Osenenko

And gpr for git pull --rebase

Collapse
pmsuntuwarg profile image
Mahesh Sunuwar

Most of the time, git log follows git status in my case. :P

Collapse
kaddkaka profile image
kaddkaka

tig gives me more information, more concisely. Try it out :)

Collapse
khoa0319 profile image
Khoa Huỳnh

Underrated

Collapse
kiro112 profile image
Jairo Malanay

Is it bad ?
Im also guilty of this one + ls and clear

Collapse
gokulkrishh profile image
Gokulakrishnan Kalaikovan

haha me too. So i added a alias as s => git status. Lol lazy me

More shortcuts like this in here github.com/gokulkrishh/dotfiles

Collapse
bhupesh profile image
Bhupesh Varshney 👾

Been there
😂😭

Collapse
highcenburg profile image
Vicente G. Reyes

This sounds like a good practice😂

Collapse
haqqer profile image
ahmad_haqqer

me too dude

Collapse
alanmbarr profile image
Alan Barr

Never taking the time to learn hotkeys. Not reaching out to a second set of eyes before spending too much time on something. Not doing enough design up front.

Collapse
ben profile image
Collapse
glaaki profile image
Sean Porter

I use vim for basically everything & I can't remember how to do macros without looking it up. I think just generalize this to "not learning your tools effectively" & I totally agree.

Collapse
jonathanspeek profile image
Jonathan Speek

This is super relatable.

Collapse
ronsoak profile image
ronsoak

I rewrite other people’s code to my extremely high standard so I can understand it. Such a time waste.

Collapse
noreading profile image
Dominik

I know this far too well. There is this strong feeling of „You can’t leave it like it is, when you know it.“ but in the end ... it would most likely run for ages without any issues if we wouldn’t rewrite it. And maybe nobody would ever touch it again. :-)

Collapse
ben profile image
Ben Halpern Author

I’m sure this thread will contain much worse habits than that! 😂

Collapse
helenanders26 profile image
Helen Anderson

Haha! you are far more patient than I am!

Collapse
hugoliconv profile image
Hugo

I do not write unit tests 😔

Collapse
otr500miles2go profile image
DIANE GAYDEN

I knew if I kept reading I'd find my bad habit.

Collapse
jnschrag profile image
Jacque Schrag

Same! I've never written a test. I know that I should, but... ¯_(ツ)_/¯

Collapse
christopherkade profile image
Christopher Kade

Small plug, but I wrote an introduction to unit testing if that could help any of you 😃

dev.to/christopherkade/introductio...

Thread Thread
jnschrag profile image
Jacque Schrag

This is great, thank you!

Collapse
mandaputtra profile image
Manda Putra

Dateline !== No test, or just lrave like this

Agile !== No test

Collapse
yashints profile image
Yaser Adel Mehraban

Not reading enough docs, whether it's a framework or API

Collapse
reddyaravind178 profile image
aravind_reddy

Totally relatable

Collapse
highcenburg profile image
Vicente G. Reyes

Stare at my editor -> search for help in duckduckgo -> open social media -> change music on spotify😂

Collapse
bhupesh profile image
Bhupesh Varshney 👾

That's literally me every single day 😂😂

Collapse
crongm profile image
Collapse
helenanders26 profile image
Helen Anderson

Being too lazy to turn off 'helpful' system settings, like the one that autocompletes a closing bracket. I used to end up adding a closing bracket myself and then having too many so had to hit backspace to get rid of one.

Now that that has become muscle memory, whenever I'm not using that tool I hit backspace on autopilot even though there is no 'helpful' closing bracket to get rid of.

Collapse
moopet profile image
Ben Sinclair

I do this all the time!
It's all muscle memory now.

The other way the IDE gets in my way is when I want to add a closing bracket or parenthesis but my cursor is already immediately before one and the editor treats it as if they're the same - so I think I've added enough, but oh no.

Collapse
helenanders26 profile image
Helen Anderson

Ugh. Instant rage quit.

There are also some strange moments when the cursor just vanishes completely and I don't know where I am anymore.

Collapse
ben profile image
Ben Halpern Author

Ah yes, been there.

Collapse
flexdinesh profile image
Dinesh Pandiyan

Step 1: Spot a code smell
Step 2: Add a // TODO comment
Step 3: Never get back to it

Repeat.

This is the story of my dev life 😔

Collapse
foresthoffman profile image
Forest Hoffman

If you're a VS Code user, checkout the Todo Tree extension.

It's a nice alternative to searching in all files for // TODO or // DEBUG before commiting!

Collapse
reebboot profile image
John Dev

Good tip 😉

Collapse
briankephart profile image
Brian Kephart

Not using feature branches.

Collapse
ben profile image
Ben Halpern Author

This was me until I worked with folks who set great examples. I eventually learned better habits.

Collapse
glaaki profile image
Sean Porter

Not sure I'd agree with this one, depends on what you're trying to accomplish.

Committing directly to trunk has its benefits, everyone gets the changes immediately but you just need to make sure that the changes are self-contained enough to not break anything.

I used to think this was the way to go too until I read Continuous Delivery
all the way through.

Collapse
kayis profile image
K

Trunk based devlopment ftw.

Collapse
htphuongse profile image
Phuong Huynh

haha, you should try to fix it soon

Collapse
stearm profile image
Stefano Armenes

You should try git flow :)

Collapse
ddhogan profile image
Donna Hogan
  • git push --force on a regular basis
  • using VSC to open dot files and not taking the time to learn vim or nano, etc
Collapse
selbekk profile image
selbekk

My git alias for that command is git fush 😄

Collapse
colorcodedcode profile image
Robert Schaap

I need that in my life. I'm an obsessive compulsive interactive rebaser.

Collapse
ben profile image
Ben Halpern Author

I don’t think the second is a bad habit. There’s no special reason one needs to be using bin or nano imo.

Collapse
ericcurtin profile image
Eric Curtin

I think all Unix/Linux developers should know vim. Because vi or vim is almost always installed on these variants. Sure for local development a UI is great, a very useful tool! But for editing files on remote machines, the ability to ssh to a remote machine and make a quick change is very important.

Collapse
citizen428 profile image
Michael Kohl

If you start using —force-with-lease instead the habit becomes quite a bit less bad.

Collapse
nickytonline profile image
Nick Taylor (he/him)

My git alias, pf,is just for that, alias.pf push --force-with-lease. More here 😉

Collapse
rhymes profile image
rhymes

Sometimes I struggle and go for the longer route instead of just focusing on the quick fix.

I often set a breakpoint and learn how code works from there instead of just looking at the documentation.

A part of me wants to fix everything but I've become much more pragmatic over time 😂

Collapse
kayis profile image
K

I try to do the right thing first.

Often I fail because of missing information, then I do a bunch of quick fixes second.

Then after the fixes built up too much, I do a rewrite as it should be and everything is good.

The second part often happens because I only find the missing information after I tried enough fixes.

Dumb problem and probably unsolvable 😒

Collapse
maestromac profile image
Mac Siri

Being too obsessed with code perfection instead of just shipping the feature.

Collapse
kayis profile image
K

Prettier and refmt helped me so much with this

Collapse
moopet profile image
Ben Sinclair

I still tend to jump in and start coding my first idea. I tell myself it's a proof of concept or that I'm experimenting with different ideas but too often I just end up going with it and not putting the effort in to find a better solution.
I do this even if I have time to plan the project out, because I've worked in tight deadline agencies for so long it's become a habit that's hard to break.

Collapse
andreasbergqvist profile image
Andreas Bergqvist

This. I guess sometimes its also a strength. Atleast I tell myself...

Collapse
kayis profile image
K

Do it with TLA+ instead! 🙃

Collapse
dance2die profile image
Sung M. Kim

Confession:
TFS (Team foundation) lets you commit your code without a message. I sometimes commit without a message...

And I reformat others' code.

The worst offender is always Googling for simple tasks such adding simple HTML elements such as adding CSS link tags and script tags... (I wonder if it's just me not knowing how to add them out of memory 🤔)

Collapse
t4rzsan profile image
Jakob Christensen

We moved all our code from TFVC to TFS Git which I can highly recommend. You get the best of both worlds (TFS backlog and project control together with Git version control). And you will never commit without a message again 😉

Collapse
dance2die profile image
Sung M. Kim

Wow 😮
Thanks, Jacob.
I wasn't aware it was possible to migrate to TFS Git and keep all the history.

I will check it out~

Collapse
ben profile image
Ben Halpern Author

No commit message is such an odd thing to me.

I also always good css link tags 😂

Collapse
dance2die profile image
Sung M. Kim

git way of forcing a message should be how all VCS should be IMHO.

I also always good css link tags 😂
😂 👊

Collapse
elmuerte profile image
Michiel Hendriks

Not writing (and updating) documentation explaining intent and purpose.

Collapse
pedroma39481947 profile image
Pedro Marques

I work in a small team (2 front-end devs), and my co-worker is a bit picky about documenting every function, class, method, etc etc.
But sometimes all he documents is something a function name tells it upfront, I really think there's no purpose in doing something like:

/** This function transforms lower case string to uppper case **/
function lowerCaseToUpper(str...);

If you declare functions and variables with intuitive names, sometimes there's no need to explain them :)

Collapse
bytenaija profile image
Everistus Olumese

It is called self-documenting functions for a reason right?

Thread Thread
pedroma39481947 profile image
Pedro Marques

yup... unless that function transforms the string using some alien computation, there's no need for that

Collapse
bsatrom profile image
Brandon Satrom

So many, here are a few that come to mind...

  • git add .
  • git commit -m {same message as the last commit, but I forgot something and don’t feel like writing a new message}
  • git push origin master
Collapse
mandaputtra profile image
Manda Putra

Im still use git add . 🤣

Collapse
daanwilmer profile image
Daan Wilmer

git commit --amend could work, although it would require a sinful git push -f if you've already pushed it.

Collapse
chiangs profile image
Stephen E. Chiang

I get debug/Refactor/develop creep. Often I'm working on one thing and I notice something that can be fixed rewritten or moved somewhere so that it can be reused... Or I suddenly decide to stub out something for later later. Sure, it's stuff that had to be done at some point, but hard to explain or justify when you list hours to tasks for a single component and for some reason a component was finished, plus 2 stubbed, plus one refactored, and a new service was created. 🤪

Collapse
perigk profile image
Periklis Gkolias

Using mouse when the keyboard can do the job in one third of the time

Stupid names in variables

Not using a git prompt

Windows 😊😊

Collapse
kayis profile image
K

Coming from years of RTS and FPS gaming, often the mouse is simply qick enough 🤖

Collapse
andyhaskell profile image
&y H. Golang (he/him)

Probably overanalysis. I've got an eye for detail thinking about edge cases, but that has a tendency to bog me down before I start writing code for the normal case that I could then iterate on, which I'm trying to work on

Collapse
crongm profile image
Carlos Garcia ★

This is what I came to post. I can spend up to an hour checking if there's something in the code base that can be reused for the task I have at hand, and then thinking about how it can be reused, adapted, or modified for different cases. And sometimes it's just easier to write a simple function or method to deal with the problem.

Collapse
karataev profile image
Eugene Karataev

It's hard for me to work with poorly written legacy code.
From one side I want to rewrite a module I'm working on to meet quality standards. But from other side usually the module is connected with other modules in an unpredicable spaghetti way, so refactoring might be a very deep rabbit hole. And there are always deadlines.
So my bad habit is procrastinating when I face such problems. I need to get a cup of coffee or scroll through twitter for 5 minutes before I can return to the work 😂

Collapse
bennettbackward profile image
Bennett Hardwick

Writing code that "just works" when I'm feeling tired.

I don't have the effort to think critically about what I'm writing and follow good practices when I'm exhausted or sleepy (generally after work when I'm working on side projects). Its akin to reading through drunk texts when I see what I what I committed the night before!

Collapse
stephanie profile image
Stephanie Handsteiner

I don't write tests.

Collapse
kayis profile image
K

Me neither.

The problem is often, that only code fails that couldn't be tested automatically anyway. (In app purchases, etc.)

Collapse
boseriko profile image
Bos Eriko Reyes

Using Facebook's messenger when I'm coding. I can't let go of this one. I think it's because I isolate myself too much. I don't go out. Not at all. I don't use Facebook (I only use messenger, I don't have a Facebook). I use Twitter to see Feed related to coding as well. So I just can't let go of messenger. I need to talk to people. But I consider it a bad habit because I keep it open while coding. It will probably be healthier to just use Messenger when I'm not coding.

Collapse
titivermeesch profile image
PlayBossWar

I'm feeling this too. I talk to people but I think it's a huge waste of time. Like serious I'm coding 12h a day at a regular base but I'm feeling like I could do the 12h work in 6h if I close social media

Collapse
bholmesdev profile image
Ben Holmes

For me, the worst habit comes out most when I'm trying to help others through problems in their code: learning when to step back and look for other solutions.

Just the other night, I got sucked into an 80 reply Slack conversation about a bug in someone's Heroku build. A lot of those messages came from my own misunderstanding in the build steps of their app and how Heroku handles deployment. After reaching a dead end pulling from my own knowledge, I did a quick crawl through GitHub to find similar issues to his own, and we soon found the culprit. Basically, I found that even when I think I understand an issue with a hacky way to solve it, it's always worth an Internet search to find the best solution.

It's really hard to find that balance of when to look for help versus when I should go with my gut, but I'm always working on it!

Collapse
rapidnerd profile image
George Marr

If I get a bug in X project that I can't figure out for a while I'll jump to another project and work on that one until I get another bug that I can't figure out for a while then I'll jump back to the original project sort that one out, and back and forth

Collapse
lbonanomi profile image
lbonanomi

Finding an exciting library/package/technique and then prowling for problems that my new toy will fix.

Never going back and removing the shell pipes and system calls after the prototype worked.

parsing argv in main.

Collapse
denmch profile image
Den McHenry

I do a lot of Razor templating (C# with HTML), and when I do something dependent on an external API (e.g., an Instagram widget), I usually wrap it in a try-catch block without handling the exception. I usually just print an HTML comment like, <!— Something went wrong with the Instagram widget. —>.

Collapse
yamalight profile image
Tim Ermilov

Using "up" arrow key in terminal to find a command instead of typing it.
I know I've used it already! 🤦‍♂️

Collapse
lbonanomi profile image
Collapse
kaddkaka profile image
kaddkaka

Use ctrl-r to search for the command in your history instead

Collapse
yamalight profile image
Tim Ermilov

I know and use that frequently, but man - that up button won't leave me alone 😂

Collapse
mfboulos profile image
Michael Boulos

I often get overconfident and forgo unit testing until I finish coding a feature. Which often leads to some really fun debugging.

Collapse
thorstenhirsch profile image
Thorsten Hirsch

I'm running yarn upgrade and bundle update way too often.

Collapse
pedroma39481947 profile image
Pedro Marques

my co-worker also bumps versions on package.json way too much without any precautions.
sometimes the code breaks and guess what.... NEW VERSION OF SOME PACKAGE is causing it!

Collapse
larizzatg profile image
Larizza Tueros

Code: When I just want to jump on codeland without think for one sec of what I am doing.

Time: I tend to give estimations too quickly.whrn someone ask me how much time is going to take me... My brain flips and it make me think I am the developer version of flash

Social media

Collapse
stojakovic99 profile image
Nikola Stojaković

Obsession with doing everything upfront, instead of making it work and improving it later. I also tend to avoid committing parts of the code related to the feature I haven't finished yet. As a result, I keep the code on my machine for tomorrow and commit when I build the whole feature.

Collapse
andrewbrown profile image
Andrew Brown 🇨🇦

When I need to use search, instead of searching in VIM, I launch sublime and search in there.

Collapse
rhymes profile image
rhymes

ripgrep needs to become your friend 😂

Collapse
foresthoffman profile image
Forest Hoffman

o.0 this is a thing?! That's awesome! Definitely going to grab that as soon as I can.

Thread Thread
rhymes profile image
rhymes

It's also the tool that Visual Studio Code uses to search :D

Collapse
pedroma39481947 profile image
Pedro Marques

When on a tight deadlines, I don't write any documentation, and sometimes code/component splitting is also left behind.
This leads to some refactoring time after the deadlines are over and boss is not in a hurry to have something ready!

Collapse
greenroommate profile image
Haris Secic

Before: relying on IDE. Lately I realised I didn't know any packages/namespaces (java, c# respectively) until I read the name and decided OK this could be the one I need. And I'm talking about main language features not just libraries.

After I've changed that habit I still copy paste stuff for JWT or any kind of filter/middleware then read code and change what I don't like, don't need or need differently implemented. Shame on me.

Collapse
javierg profile image
Javier Guerra

My editor is VIM, and I use arrow keys. Also I don't use autocomplete, I actually hate it. Not sure why. I like to write words my self. Anyways, most of my time coding is hitting arrow keys, not typing actual code.

Collapse
karlredman profile image
Karl N. Redman

porn

however you define porn these days.... it's a distraction. If your porn is hours of netflix, ok. But that is potentially a bad habit. Basically everything that isn't productive is bad -right?

I disagree with this concept. IMHO people need to do various things in order to be productive at 'something'. I think there's some science behind this but meh, look that up on your own time.... I have 1 year to catch up on free BBC Dr. Who episodes via some darkweb torrent somewhere...

Collapse
itmayziii profile image
Tommy May III

Never doing the bandaid solution and always engineering things to a fault. This doesn't sound like too bad of a thing but trust me it's okay to put on the bandaid sometimes. I would have saved many hours if I would have put the bandaid solution on some features that my project owners didn't even want a few weeks / months later.

Collapse
shroudedmoon profile image
Michael Whitis

I have a bad habit of overengineering things, so I never trust the code I wrote previously, even yesterday, or before lunch, or before that last meeting, or.... so have a horrible workflow of git reset —hard then rewriting or restoring from local history all the things I just worked on.

Collapse
swlkr profile image
Collapse
daanwilmer profile image
Daan Wilmer
  • Getting distracted by social media (especially dangerous when my music is on YouTube).
  • Writing tests after I wrote the code, when I should've used TDD and wrote the test first.
  • Not asking in time (although consciously trying to ask more often does help)
  • Being late for the stand-up
Collapse
gypsydave5 profile image
David Wickes

What's meat to the goose is poison to the gander...

Collapse
m_nevin profile image
Marc Nevin

I jump around editors so much that quite often I commit files I've been editing in VSC with a :wq at the end

Collapse
daanwilmer profile image
Daan Wilmer

My trouble is with esc. Let me click here... open a modal... enter some text... done typing, esc... dammit, where'd it go?

Collapse
hir_patel profile image
hiral patel

Constantly checking social media along with coding.

Collapse
ddhogan profile image
Donna Hogan

struggling on my own for an embarrassingly long time before finally asking for help 😖

Collapse
joeberetta profile image
Joe Beretta

Use Git GUI more often than CLI.

Collapse
jevason90 profile image
Jonny Evason

All of the above? I guess the worst is getting distracted with new ideas and not completing the current tasks.

Collapse
stefant123 profile image
StefanT123

Two things:

  • I Always try to reinvent the wheel. It's very time consuming, but I guess that's my way of learning things.

  • Trying to learn everything even though I know that's immposible.

Collapse
pedroma39481947 profile image
Pedro Marques

Sometimes I too feel the obligation to create something from scratch, instead of picking some package/library that does that already!

Collapse
edlinkiii profile image
Ed Link III
  1. Procrastinating
  2. Not starting my work right away
  3. Being lazy when I should be coding
Collapse
filipmessa profile image
Filip Messa

I use console log for debugging instead of debugger tool. So sometimes I lost in all these messages in console.

Collapse
mandaputtra profile image
Manda Putra

I think using console.log arent bad. But leaving it without reason maybe that bad 😀 sometimes weird bug just need console.log not fire up debugger unless it is complicated stuff like long long long query