Hacker News new | ask | show | jobs
by AllegedAlec 2321 days ago
> The amount of unqualified candidates that have a decent CV and are reasonable to talk to, but completely unable to correctly write a while loop is too damn high.

There was some research into this, and IIRC, only half the programmers, both experienced and junior, got a while loop right (IE: no off by ones etc) the first time.

2 comments

I had to write a while loop in an interview recently, and I also made the off by one error on my first attempt. But after I ran through a couple test cases by hand, it was pretty easy to see the mistake and fix it.

I wouldn't say getting it right on the first try is the most important thing. Writing code, logically thinking it through, and running through test cases to fix mistakes is pretty similar to how coding on the job is, albeit with less contrived problems.

A long, long time ago, somebody wrote about how most supposedly competent programmers can't write a correct binary search under test conditions.
Unless we simplify it significantly, it's surprisingly hard to do. And completely irrelevant anyway.