If you are a junior developer, a student or you have been coding for 10 years, don’t despair – All developers of all levels make stupid mistakes all the time.

Recently a buddy of mine who is studying Computer Science was chatting to me about some coursework they were working on. They were having a hard time getting some PHP to work.

After casting my eye over it we noticed that it was a pretty standard error made by new programmers in that they assigned a variable twice by mistake. They made the following comment;

Do you get stuff like that a lot or you too good for that?

The first thing I should say is I am not too good for anything but I knew what they were getting at.

In my experience the more you know about development just means that you make different mistakes, you will stop making the mistakes you made as you learnt a language or a design pattern but you will always uncover new things to make mistakes over!

You will also occasionally forget a semi-colon or do something that you would think should be reserved for new folk to development.

There is a good discussion on the Programmers StackExchange (the link now 404s) were the question is asked (parts removed for brevity);

I am currently in a situation where a lot of people criticized me for making bugs (on my first local try - the first time I run the code for the first locally done test - , not on a committed repo though, management look at me very closely). The majority of my bugs are most often not algorithmic (they are more like mistaking one var for another, a forgotten line, a missed method call). The people criticizing me say I need to be able to make code without bugs. Correct on first try. And now, what is the way to avoid making mistakes now? (Other than practice more and focus on a particular area)

Honestly I think their management are idiots saying that they have to be able to write code perfectly first time, regardless there are some great nuggets of advice in the answers, for example;

There is nothing bad at making bugs on the first try. In current days of quick, incremental compilation and intelligent IDEs, that mark errors without compiling, first-time methods are not that big problem. It is much more profitable to put your energy and focus into actual errors in logic of the program, than focusing on putting correct interpunction. Because compiler will tell you where the error is and fixing it is quick and easy.

Twitter Responses

I went ahead and asked on twitter “People who consider themselves good developers, can you confirm that you spend a lot of time fixing dumb mistakes you made yourself.”

Here are some of the responses;

@tosbourn Yep. All the damned time. — David Turner (@HerrWulf) December 21, 2014

@tosbourn it's the whole reason that before you say out loud "ugh who did this, let's do a git blame", you do a sneaky git blame in advance. — Will Hamill (@willhamill) December 21, 2014

From around the web

I will update this post every so often with quotes from around the web I have found which prove some of the smartest people in our field make really dumb mistakes.

Too often, programmers beat themselves up when they can’t remember an API and have to Google it, or they lose an hour to a simple spelling mistake. Everyone does these things. From a 2016 blow by blow account of making a Rails feature from scratch

Conclusion

So yeah, it happens to everyone at every level of their career, don’t lose heart! If you know someone who is struggling and feels they are continually making dumb mistakes you should share this with them.

But Toby, I still feel bad about making mistakes

That is only natural. There are some things I’d suggest. Getting into good habits like backing up, or documenting and knowing what to do when things go wrong.