I recently interviewed for a software development position where the employer asked me to provide a code sample to judge my experience level. I provided an application I recently completed as a side project. It had the basics of what they were looking for in the technical specification for the role so I thought it would be sufficient. But they came back to me after few days rejecting me as they judged me to be too "junior" for the position. I have worked on more complicated applications but that code is protected by NDAs and such.

How can I impress a potential employer and avoid potential lawsuits in the future?

  • 11
    Write a more complex code sample.
    – paparazzo
    Sep 30, 2016 at 15:14
  • companies who ask for code samples usually have a defined project and ask you to do it. Otherwise, they should have asked you to implement a list of features and basically provide you with a simple "requirement" list.
    – AleX_
    Sep 30, 2016 at 15:15
  • 1
    I think if you upload to github and provide a link then you are good to go. However, I find it very rare companies ask for code, so I wouldn't spend too much time worrying about it. Maybe one or two really good samples, and they don't have to be super complex.
    – Dan
    Sep 30, 2016 at 18:48
  • 2
  • see also: Recruiter is asking for sample code
    – gnat
    Jan 10, 2018 at 21:39

5 Answers 5


The first thing to do would be to ask for specific feedback from the employer. Not all employers will respond to such a request - it may be against policy to say anything other than accepting or rejecting a candidate. Others may be more forthcoming with tips and suggestions.

Since you submitted your own personal code and not a company sample, you should get some other opinions on your code. Code Review Stack Exchange is one option. If you have any friends who are also software developers, they may be able to help too. If you worked on a company-provided problem, you should ask them before giving the code to anyone else as they may not be appreciative of potential solutions to their coding problems posted in public places, even if the solution wasn't up to their standards.

In the future, if you are asked for a code sample, you can ask them if they have anything in particular that they would like to see or a problem that you can solve. Ideally, you would solve this in the technologies that the company uses if you know them, but some companies are more accepting and would look more at general approaches to solving the problem.

If the company doesn't offer problems, you can find examples. You can go to Project Euler, Programming Praxis, TopCoder, or Programming Puzzles and Code Golf Stack Exchange. Create a GitHub repository and spend whatever you think is a reasonable amount of time to develop some samples. What is reasonable depends on you. Since these are public samples, I would follow my advice above - get other people to review and provide feedback.

The notion of a programmer needing a portfolio is common, but it does a huge disservice to individuals. Many jobs involve building proprietary and closed-source software and also 40+ hours/week of effort, leaving little time outside of work to have a personal life yet also build a respectful portfolio. If a company is not willing to respect and understand the nature of propriety software and the need of people to have a work-life balance in the hiring process, that would be a huge red flag about the company culture and how employees are treated.

  • 6
    "Code Golf Stack Exchange" is for masochists.
    – gnasher729
    Sep 30, 2016 at 18:06
  • @gnasher Probably, but I didn't say you had to participate there. Some questions are interesting and can be solved and thrown into a public repo. Sep 30, 2016 at 18:07
  • I agree with the request for feedback. What are they looking for exactly? Specific concept demonstration, formatting, documentation, all of the above. I find it weird that a developer would carry around a portfolio of code, but I'm not a developer, so.... Sep 30, 2016 at 20:54

You had bad luck this time around. Review the code you used to see how well written it is. You have no way of knowing whether it was the code sample or just some guy who saw it who didn't like the way it was laid out.

If it's well formatted, well written code then it should have been fine.

You can spend a bunch of hours writing useless sample code for a portfolio, or you can just move forwards. The next potential employer probably won't ask for a code sample.


Just like photographers and artist have portfolios, so should software developers. You can put in it whatever you can think of that will demonstrate your skills. The advantage to a serious portfolio is that you are making a working application that can be more complex than a sample. You can build on it and as you come across new technologies, you can add to it as well. The difference between a portfolio and a sample is that a sample is just code you send. Your portfolio is the well-rounded showcase for your work, not just bits of code here and there.

For starters, learn Git and set yourself up a Github repository. Once you've done that, just make up some kind of project that doesn't really exist and start coding away. Look at some of Microsoft's sample projects for some ideas. Then what you do is share that portfolio with anyone who you want to have it. It'll also likely be found on Google anyway.

Second, set up a host where your application is actually running. Let people see that you can code and your code actually works.

A key to a successful portfolio is semi-permanence and building on it. Let potential employers see a lot of what you can do rather than just some code that you send them.

Also, get involved in Open Source. I can't suggest that enough too. It looks good on your resume, gives you some code you can point to and it helps you hone your skills.

Jeff Atwood (one of the founders of Stack Exchange) said it well:

[a portfolio] part of the job description for a graphic designer, but why shouldn't this rule apply to software developers, too? ... Anyone can put together boilerplate resume text, full of assertive verbs and fancy keywords. Blah blah enterprise blah blah strategic blah blah architect blah blah. The benefits of "show, don't tell" are much more compelling.

  • 8
    There's a difference between artists and programmers. When I've had professional photos done, I've been asked by the photographer if he can use the photos for demonstration purposes. A programmer asking if he can share code snippets, much less meaningful projects, outside of the company? That would rarely fly. The other options that you present require a large investment of time. If I work minimally 40 hours a week, I don't want to go home and sit at a computer more. I have friends and family to spend time with, along with non-programming hobbies. Sep 30, 2016 at 15:31
  • 4
    @ChristopherEstep You suggested setting up a GitHub repository and being involved in Open Source. After learning new tools and technologies and writing proprietary code for 40+ hours/week, I shouldn't have to go home and spend even more time in front of my computer in order to demonstrate to perspective employers that I can write code in order to get a job. Sep 30, 2016 at 15:42
  • 7
    I don't agree with those experts or companies that expect you to have a portfolio. Perpetuating the need for a portfolio for programmers is doing a disservice to the profession. Sep 30, 2016 at 15:53
  • 1
    @ChristopherEstep I had to, on several occasions, fight contracts to remove clauses that would place anything I did, specifically at any time (on one occasion it was without a time limit even after employment ended), on any device (regardless of who owns the device) under the ownership of the employer. This was in Texas. I always got it out but I know that several coworkers didn't ask. I don't know if it'd be enforceable but this was in contracts.
    – xxbbcc
    Sep 30, 2016 at 22:21
  • 1
    @ChristopherEstep "there are well-respected experts who see portfolios as essential." Jeff Atwood, who you linked as an "expert", is an expert here in what sense? An expert at hiring people? An expert at telling people through his blog how they should do things? Oct 1, 2016 at 2:17

I would ask for more specific feedback. What about your code makes it appear "junior"?

You also may want to post it on SE's Code Review site for additional feedback.

Lots of developers do not write code that they own, or the code they own is for small personal projects/tinkering and isn't of professional quality.

You should either take feedback on your current code and improve it to be of more senior professional quality or explain that you cannot provide a code sample but would be willing to complete a coding exercise or whiteboard session with them.

  • I think asking the employer to provide a coding exercise seems like a good request.
    – DroidGuru
    Sep 30, 2016 at 15:46

I assume you've heard of the bear joke.

enter image description here

Luckily for you, you don't need to write a super complex application nor a perfect application, you just need to write a code sample that is as good or better than what your other competing job-hunters have submitted for the same job.

And those competing job-hunters have the same constraints. No one can submit code from work. And professional developers with good open source side projects are either very rare, or just too expensive to hire for most software development jobs.

So if you take what the interviewer said at face value, then that means you may want to slightly improve your existing code sample.

If you don't know what to add, I'd suggest that you ask some of your developer friends in the same field, and just try to add some of those improvements one at a time. Again, it doesn't take much, because almost anything constructive you add will differentiate you drastically from your competition.

And ultimately, job-hunting is also a numbers game, so don't take any single rejection too seriously. Apply to many places. Employers do use different ways to evaluate applicants.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .