Is there really a pandemic of incompetent devs?
The worlds most popular coding challenge could be misleading
I think Iām going to dump āThe week in techā concept, it didnāt seem to be that popular, and Iām way too lazy to keep my eyes open for interesting tech goings on every week.
So to the clickbait title: āIs there really a pandemic of incompetent devsā, If you want the TL;DR version, then no. No there almost certainly isnāt a pandemic of incompetent devs. For the longer, and Iād like to think, more interesting version, read on.
This idea of mass incompetence amongst developers goes all the way back to when I was a mid level dev, struggling to become a senior. Blogging was only just starting to become popular (hard to imagine blogging wasnāt even really a thing less than two decades ago!), and of course like todayās top tweeters and most liked youtube personalities, the early tech bloggers discovered that controversial posts boosted page views. One of these controversial topics they liked to post about is how devs canāt dev very well.
One of the most famous of these was written by Jeff Atwood, who would go on to co found stack overflow. It stated boldly:
199 out of 200 applicants for every programming job can't write code at all. I repeat: they can't write any code whatsoever.
Having interviewed many developers, from every level from junior to lead, I can say with confidence that this stat simply doesnāt ring true.
The article mentions a programming interview question, which has since become infamous. So infamous in fact, that itās fame probably stops it getting asked that often in interviews. The question is: FizzBuzz.
The challenge is as follows:
Write a function, FizzBuzz that takes an integer argument, i. Loop through ints from 1 to i. For each, print the following on itās own line:
The number is a multiple of 3: print Fizz
The number is a multiple of 5: print Buzz
The number is both a multiple of 3 and 5: print FizzBuzz
None of the above are true: print the number
An output for i = 5 is as follows:
1
2
Fizz
4
Buzz
This seems like a very simple task. Well, it is a very simple task. So why are so many devs supposedly failing? Are we all incompetent as an industry!?
I think there are 3 things that explain this, but before I go into them, letās look at my implementation of FizzBuzz so we have some reference. Iām sure some people will point out it isnāt the most elegant solution possible, but as you will see that is kind of the pointā¦
We loop through the numbers 1 .. n.
If i is a multiple of 3, output fizz.
if i in a multiple of 5, output buzz.
If i is neither a multiple of 3 or 5, output i.
Output the newline character.
I get what youāre thinking. This solution seems a little clunky. I do each check for a multiple twice. Since you never print both a number and a string surely an else should be used somewhere?
Iād 100% stick with this solution. There are 3 reasons I think this āno one can actually codeā myth started. Choosing a āclunkyā solution addresses the first two of these points.
The first reason I think this causes an issue is because fizzbuzz is so easy to write to make to work, but so much harder to write in a graceful manner. Devs in interviews are aware that people will look at, and judge, their code very carefully. This makes them want to write a very pretty version of fizzbuzz.
Note this violates the first law of coding interview tests: make it work first, aka brains before beauty.
People can tell the problem is easy, and so panic when struggling to quickly write out a pretty solution. This leads to them looking like they canāt code.
The second point relates to the first. Back when this problem was first posted many interviewers still insisted coding exercises were done on a whiteboard or via pen and paper (lolololol). When you try and make something fairly simple but niggly like fizzbuzz look pretty in handwritten form, youāre going to make lots of mistakes. When coding on paper there is the urge to ācode your wayā out of a bug so you donāt have to cross stuff out as that looks nasty. All in all I think many people messed it up purely because they tried to make it nice on paper and got themselves in a pickle.
The final thing I think is going on here is as old as the internet: lying for clicks.
I outright call bullshit on 199 out of 200 applicants for coding jobs failing this. Unless of course they are just posting ads saying āProgrammer wanted, earn $100k, no previous experience requiredā - in which case this is all their fault - then I donāt think almost every person is failing this test. I think they have massively over exaggerated for clicks.
There is a technique that works really well for winning over readers: you make them feel smarter than everyone else. What better way than pander to a readership of developers than to present them with a fairly simple coding exercise which they can do, then tell them 99.5% of devs fail to do it. Waheeey! They are suddenly in the top 0.5% of devs, and so clearly have a bright future. I just know that since youāre smart enough to have subscribed to my substack, you wouldnāt fall for something like this. š
Takeway: Always solve tech interview questions in the dumbest way possible which works, you can always refine your solution, but only once you have something working.
Yours in code,
WPG