Ok, its tough not to laugh at this post from Ayende. He’s going through the process of trying to hire someone for his team, and asks those who apply to complete some simple programming tasks. I’m sure he’s glad he does.
But how did this happen? How did someone write code this bad?
Let’s make some assumptions. I think Ayende wouldn’t have wasted this person’s time as well as his own if the person didn’t pass at least an initial resume review. That means they probably have a base level set of experience:
- The developer probably has some degree in a computer-related field. Maybe a B.S. in Computer Science. Maybe even a higher degree.
- I don’t believe he’s hiring at the entry level, so this developer has probably worked at least a couple years as programmer in a paying position.
- Applying for a .NET/C# job here means this person feels most comfortable in that language.
This should give them every opportunity to become a valuable contributor as a programmer.
From looking at the code, however, we can tell they really only know:
- In ASP.NET Webforms you can bind an event to a button click.
- How to pass a hard coded sql query to a database connection and get query results back.
- That wrapping your code in a try/catch block keeps your code from crashing with an ugly error message - especially if you don’t bother writing the “catch” part.
In other words, just enough to squeeze by if no one ever looks at your code.
Compile this application and put it up for your (non-technical) manager or client to review and everything works fine. No one tells you it’s bad, so the next time you have to build something similar, you do the same thing again. It’s all you know. Without code reviews, I imagine a developer could go years thinking they’re building up their resume, only to be disappointed the first time someone actually does dive deep into their work.
Now, this might be a blatant example, but there are more subtle ones everyday. If you’re a programmer, do yourself a favor find a coding buddy if you haven’t already.