I'd recommend ignoring Maratd's advice.<p>I used to be a horrible coder. I used to have just the issues you describe here. I wrote spaghetti code, I didn't understand objects and classes properly, I probably had every bad habit in the book.<p>I kept getting noticed as a 'good programmer' because I did stuff other people didn't get. I was good at figuring out the puzzles how to make pieces fit, but I was, quite frankly, a bad coder.<p>I got a contract for a big company, and I wrote the app they wanted. The code was awful, but I didn't know that. When I finished the contract and passed the app over to their IT division, it went through a 'code review' process.<p>I'd like to be able to tell you that the CTO pulled me aside and told me what was wrong with my code. Had he done that, I would have taken back all my work and refactored it for them so it was well written. But, of course, he didn't do that.<p>If the CTO had taken the time to explain to me why my code was bad, I would be very grateful for the learning experience. I would look back on that time as a defining moment which sent me on my course as a professional software engineer. But he didn't, so instead, I gradually, over the course of a few years, learned what it meant to write good code.<p>I probably lost my first coding job because my code wasn't great, but it could have been, had somebody taken the time to explain to me why it wasn't good.<p>So, I hope you can look at this not as a time for a 'scathing code review', but rather as an opportunity to help a struggling coder to maybe become excellent.<p>I think the most important thing may be to NOT do the work for him. Stop at what you've got so far and you can use it as a comparison, so he sees what the difference is between what you did and what he did.<p>Then let him take another shot at it. If he doesn't want to redo it, or thinks he can't, then you'll know he's a bad employee and a likely not going to grow to become a good coder. If he jumps at the chance and is eager to learn, you'll know that he might have a shot at this.<p>Do make sure you go through your HR process (if you have one) of recording the poor performance though. But let him know that you have to do that just so that the company isn't stuck with him if he isn't able to adapt. But if this is approached properly, it may be the best gift you could give the new hire.