We've all faced this. You apply to a cool project and they ask you to send them a piece of your code. On the surface, this look OK and I am fine with it.

But what shall I send them? My cool utility? Snapshot of structure in complex project? Something else?

So far, I have tried to persuade them to have a desktop share via Skype and that I lead them through code and structure. But somehow clients do not like this approach.

So I'd like to hear your thoughts.

  • 3
    Keep in mind that they probably want to see your code to ensure you write readable code, meaning don't try to send them something "clever". Send them something done properly in your code, with comments, indented, and with consistent spacing.
    – Neil
    Nov 26, 2013 at 10:56

3 Answers 3


Do you keep track of the stuff you've built for other clients?

If you are a freelancer (it seems like you are) you should keep links to past projects you've done for other clients. I know that as a client I would click on the other projects to see exactly what you're capable of. Client testimonials would go well with this too.

Of course you don't want to define yourself by just your past projects, so you could also keep links within your website to demo projects you've worked on too (normally your demos should highlight how 'deep' your knowledge level goes - as chances are, you haven't built that many complex projects for clients). Snapshots could work here too (if you don't have links to actual demo projects).

Lastly, for displaying code, you can just link to your GitHub account to your website. You don't want anyone having access to proprietary code you've written for another client, and GitHub (or even bitbucket) is a great place to display code you want displayed (remember though, seeing your code will depend on the client, as most won't care about that unless they are technical firms themselves).

PS. You should just note that in situations like these, you are marketing yourself (especially if you are a freelancer). It is important that you look for strategies to improve your brand (which is basically YOU).


First, Look at your question from the client's perspective.

They don't necessarily know you, your work ethic, or the quality of your code. Maybe they have a referral from someone they trust, but in many ways you are an unknown to them.

And then think about why they are interviewing you. They have a problem that needs to be solved; they need some code written or modified to support their business.

Keep in mind that they are asking for a sample in order to help answer those unknowns.

So what sort of a sample should you provide them?

The short answer is to provide them with a sample that comes as close as possible to matching their expectations.

The longer answer is that this can mean:

  • Nothing that's proprietary. If you send them a previous client's code then they'll know you'll do the same thing with their code.

  • Code that's in their preferred language. Don't send them a Java sample when they're working in C#.

  • Code that's in the same segment of the application stack. Don't send UI code if they need a service written. Likewise, don't send a database access / ORM piece if they need a visual.

  • Code that matches their likely request. Do they need maintenance? Show them a before / after picture and show how you made the requested changes within that project. Do they need a complete project? Then provide them with a small sample that mirrors everything that you would be providing as part of the contract.

  • Code that matches their business domain. Are they in product sales or perhaps services? Find a sample project that did the same or similar type of a thing.

As a freelancer, your code sample is a piece of your coding portfolio. Just like an artist, you need a catalog of previous work to show what it is that you can create. Working on open source projects can be one source of samples. You can also point to your StackExchange profile to help show some of your thought processes and communication skills.

Clients generally want a sample that they can dig through on their own. If they need a walk-through (via Skype) in order to understand the code, it may give the impression that they won't be able to maintain the code later on. If you generally provide documentation along with your contract work, I would include relevant samples of your documentation along with the code sample you provide.


I say, don't send a sample. You're not a perfume maker. You're a problem solver who uses code and software as your main tool, and the code you'll write for the client will be made to fit their needs.

Send references. Send testimonials. Send descriptions of past problems you've solved and how you went about designing the solutions.

If it's an open source project, it's best to start by submitting patches and fixing bugs.

Don't sell code by the pound. Code samples are meaningless.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.