You might have noticed that we are looking for more people again. Mostly because I gripe about some of the bad ones here every now and then.
One of my absolute requirements is that I want to read a candidate's code before hiring them. Some of them have made significant contributions to Open Source code, but a large number don't have any significant body of code that they can show. That is why we ask candidates to send us a coding test.
We had people flat out refuse to do the coding test, and some who thought that the questions were incredibly hard and unrealistic. We had people who sent in code that was so bad it caused migraines, we had people who sent in code that wouldn't compile, we had people do stuff like read a 15TB file (16,492,674,416,640)! times. And just to clarify, that is factorial(16492674416640). I don't know what the actual value of this number is, but is it big.
The nice thing is that you can usually tell right away when the code is bad. We also play a game called "guess the candidate's background". We have about 89% success rate there*.
Spotting good code is much harder, because a really successful submission is going to be boring. It does what needs to be done, and that is it. Our most recent hire's code submission was so boring, we had to analyze it using our standard metrics to find issues (our standard metrics are for production code running in a high performance DB for months on end, not the same metrics we evaluate code submissions).
And then… then there is this candidate, whose code is so unique that I decided to dedicate a full week to explore it. The code looks good, documented, there are explanations that show what is going on and they are going in the right direction, on the surface of it.
And then there is the devil in the details. I have quite a lot to write about this particular submission, but I'll just start with the following:
//Find today's log file in the directory
public string LogFileFinder()
string files = Directory.GetFiles(LoggingAggregation.Program.GlobalVar.path, "*.log");
for (int i = 0; i < files.Length; i++)
int slash = files[i].LastIndexOf(@"\");
int dot = files[i].LastIndexOf(".");
string fileName = files[i].Substring(slash + 1, dot - slash - 1);
string fileDate = DateTime.Now.ToString("yyyy-MM-dd");
return fileName + ".log";
Now, another way to write this code would be:
Path.Combine(LoggingAggregation.Program.GlobalVar.path, DateTime.Now.ToString("yyyy-MM-dd") +".log")
I literally stared at this piece of code for several minutes, trying to figure out what is actually going on there. I wasn't able to.
As an aside, we sent the candidate a rejection notice, along with a few pointers to some of the more egregious things that were wrong in the code. They know how to code, it is just that it goes sideway in the middle.
* The game call to guess the candidate's default language settings. That is, someone who write C# code, but has been brought up on C, so have a C style to the code.