Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Coding Mistakes = Bad Coder?
14 points by singular on Oct 27, 2010 | hide | past | favorite | 11 comments
Hi,

I want to know whether other HNers have experienced something I experience on quite a regular basis - as I am coding I will very often overlook something obvious and make a very silly mistake. These are almost always resolved immediately, usually with a thought similar to 'how could I be so stupid?!'. What makes this worse is that it happens with stuff I knew really well as well as stuff I'm not so familiar with.

What I worry about is that this might indicate a lack of skill, or perhaps even more fundamental than that, a lack of talent.

I feel I have talent in programming because it seems to come easily to me, I have flashes of insight on occasion, and my brain seems to work well in the 'gear' of programming, but this possibility is just totally eating away at me, especially since I want to one day work somewhere I'd be happy, or found a startup myself - if these 'top tier' roles require me to be talented, what if I'm not?

I wonder whether it might be indicative of tiredness, or just not being in the right 'head space' for coding at the time, but I seem to experience it even when I'm 'on the ball'.

Another possible explanation is that I am so focused on a particular part of a problem that my brain remains in auto-pilot at effectively the wrong level when I go to perform some other task.

Okay, so perhaps this is a little vague, so to summarise - do you guys ever experience making silly mistakes when coding then quickly recovering? If not, why do you think I do, and do you think it is an indictment on my ability as a coder?

Thanks!



do you guys ever experience making silly mistakes when coding then quickly recovering?

Yes.

A good coder isn't one who doesn't make any mistakes -- everybody makes mistakes. A good coder is one who writes code in such a way that mistakes will be detected before the code ships (via compiler warnings/errors, static analysis, assertions, tests, et cetera).


This is absolutely normal. A significant amount of what everyone does is done wrong the first time, no matter how careful you are. "Just get it right" is not sustainable, no matter what effort you put out. I think that the usual estimate is about 10%. As in about one line in 10 initially contains some typo, syntax error, thinko, etc.

The key is to set things up such that these mistakes are caught and fixed before they hurt anyone. If you want to learn a lot about how to do this, I highly recommend reading Code Complete. Yes, I'm aware that it is a tome. However it is a worthwhile tome that is worth reading and re-reading until you've incorporated it as practice.


I've got a copy and will definitely read through it. I've already gained a great deal of pleasure despite having only read a small part of it so far.


Absolutely. The best programmers I know make mistakes constantly, but have developed ways of working that ensure they get found early.

For some people that means using TDD, for others (like me) it means semi-formally deriving code and running checks during writing.

So no, making mistakes while writing is not a measure of programmer quality.


> The best programmers I know make mistakes constantly, but have developed ways of working that ensure they get found early.

That's what I do. You don't make the same mistake twice in the same section of code: sometimes the code is wrong, sometimes tests are wrong, never both.


>> 'how could I be so stupid?!'

This reaction, or something similar, is very telling. I'd hazard a guess that having that response is indicative that you in fact do have the right mindset to be a programmer. I'd be more worried about someone who just shrugged it off with a 'programming is hard' or had no self-doubt.

Or perhaps I'm just convincing myself, because I make spleling and syntax mistakes constantly while programming and 'stupid' is always the first word that comes to mind once they're caught.


What matters isn't so much how often we make mistakes, but how we react to them - which includes making prompt fixes just as much as admitting to the team that we actually made a mistake.

Especially if it's a "silly" mistake.

In a development context, I'll often find that a problem that seems to just generate pure static in my mind for the first 5-10 min that I think about it will often "solve itself" in the course of the next coffee break, subway ride, or (if the company I'm working for has enough common sense about human nature to allow for it), mid-day nap.

By contrast, it's those alpha-geek types who basically seem to be -never- able to readily admit a mistake of their own (yet continually grate on others for their, like as not far lesser mistakes) that I find far more intractable to work with that those who are just a bit inexperienced, or absent-minded.


The only coder who does not make any mistake, is one that doesn't code anything.

Since - as you say - you recover quickly, that's a good trait, and a good sign, and an important ability for a coder.


The true mistake is the one you do not correct.

Testing and code review should give you the opportunity to do so, among others. Also, there's always a trade off between bullet proof and time to market.


My version is write less code. It doesn't always work, but it is usually a misunderstanding of the domain ( which is a function of no specs).


thanks all, I can't tell you how much these comments provide relief on this subject!! :)




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: