Answering a code test like a literature pop quiz
We get some… fascinating replies from candidates to our code tests. Some of them are so bad that I really wish that I could revoke some people’s keyboard access:
Case in point, we had a promising candidate from Israel’s equivalent of MIT (Technion, which is in the top 25 engineering schools in the world).
He submitted code that went something like this:
var nameFirstChar = char.Parse(name.Substring(0,1).ToLower()); switch (nameFirstChar) { case 'a': using (StreamWriter indexFile = new StreamWriter(Path.Combine(basePath, "Name_IndeX_A.csv"), true)) { indexFile.WriteLine(name); } break; case 'b': using (StreamWriter indexFile = new StreamWriter(Path.Combine(basePath, "Name_IndeX_B.csv"), true)) { indexFile.WriteLine(name); } break; // ... // you can guess :-( // ... case 'y': using (StreamWriter indexFile = new StreamWriter(Path.Combine(basePath, "Name_IndeX_Y.csv"), true)) { indexFile.WriteLine(name); } break; case 'z': using (StreamWriter indexFile = new StreamWriter(Path.Combine(basePath, "Name_IndeX_Z.csv"), true)) { indexFile.WriteLine(name); } break; }
And yes, he had the full A-Z there. This was part of a 1475 lines methods. And no, he didn’t handle all the cases for Unicode.
Yes, he just graduated, but some things are expected. Like knowing about loops.

Comments
Comment preview