You need to learn the rules before you break them, as the old saying goes. That’s doubly true in programming, where not internalizing the basics can result in you building buggy, broken software.
When you’re applying for that first programming job and need to submit work samples, you want to present yourself as someone capable of building production-grade code. This isn’t the time to show that you can use every cool or esoteric programming technique or fad; you just want to get the job done.
When applying for any programming job, it’s best to stick to a traditional approach, one that shows you know how to conform to specifications. Keep the sample code clean; indent properly; use comments; and so on. Once inside the company, you can always make the case for a different style.
With that in mind, if you’re applying for an entry-level job as a professional programmer:
Any code samples you write should be well-presented, with a focus on functionality and documentation. That could mitigate many of the reasons that a potential employer will turn you down.
Aim for Production Quality
Although you might be tempted to code quickly in order to move onto the next part of the test, take the extra time to create solid, production-quality code that works and is well-documented.
Call Out What You’re Doing
You want your employer to know that you’re familiar with quirks, odd syntaxes, and other issues that crop up with programming languages. With that in mind, your sample code should call out exactly what you’re doing. Take C++11, for example; knowing lambda functions in this context is important, and demonstrating that for an entry-level position could take you far. In that case, it can be worth writing a comment along the lines of, “Here I’m demonstrating how to use a lambda function, although this code could also be written without a lambda function.”
If you do leave comments, be prepared to discuss them further in a follow-up interview. Ultimately, you want the potential employer to say, “This person knows his or her stuff and will perform well,” and not just, “This person is cool and knows the latest fads but that’s not what we’re looking for.”
Of course, there will always be exceptions. Some startup might want a flashy coder, simply because they think tricks are an indicator of real skill. But if you’re applying at an established firm, playing things conservatively is likely your best option.
If you have several years of programming experience, you’ll have a lot more than just a few code samples to back up your abilities; you can point to past projects and products as examples of your virtuoso coding. But when trying to land that first or second job, it’s best to play it safe: Show that you know the basics and tools, and that you can use them to create clean code, and you’re in a good position to land the job.