What is the line between using open source code and writing the code by your own for completing an interview task?

Obviously, I don't need to implement a task from scratch but is it okay to use boilerplate that provide multiple useful tools, and after that you don't need to set up Webpack or Swagger or other stuff and only focus on writing the task?

  • 1
    Interesting question! (I upvoted it) - particularly since a highly related question could be "using the standard libraries" (e.g. JSON parsing) vs writing your own. All depends what they are looking for, but I think they ought to have made that clear really. – seventyeightist Jul 8 at 19:42

Ask the interviewer

Some will be OK with it, some won't. Anyone worth working for or with will be happy that you clarified it with them rather than making assumptions.

  • 69
    ...and for any interviewers reading this, I strongly suggest you design your interview coding tests so they give you an accurate idea of the candidates coding ability. This means giving them whatever tools coders actually use, like IDEs, frameworks, libraries, and google. (Or continue to use useless brainteasers and artificial "test" conditions and leave the good candidates to me). – MGOwen Jul 8 at 1:13
  • I had to do some basic routines as part of a test and it was obvious that the intent was to create my own code. If it was not clear I would definitely have asked, I don't see how that could go wrong. – Joe Jul 8 at 17:06

If you can use open source, do it. The interviewer wants to assess how you work - if someone spends ages writing a library that already exists somewhere, they're actually spending time writing bugs someone else has already fixed, when they could be using that library to add features. That's not an effective use of time.

I interviewed for an insurance company a few years ago in London, and their programming task was clearly algorithmic. There was a problem description, inputs, expected outputs, and no library in the world existed that could do it for me. They clearly wanted to assess my algorithmic skills.

Around the same time I interviewed for a company in Manchester where their main product was dealing with phone numbers. Although not the main point of the exercise, I still had to use some utilities related to telephone numbers, so I started writing a parser for that. Then I looked online briefly, and replaced everything with something made by Google for Android, which did the same thing a lot better than I could. I mentioned this in the interview, and it was clear I made the right decision, because parsing phone numbers was not the main task.

So, go with your gut. If you can use open source and it helps you save time, do yourself a favour and go for it.

  • 1
    Great answer! How about adding that you should let the company know when code isn't your own? It may have been implicit to you but not necessarily to all readers. – Ellen Spertus Jul 7 at 15:51
  • 1
    I've only had one time where an interviewer gave me a coding test before the interview. I spent about 20 minutes on Google before sending him back a perl one-liner that completely solved the problem. While he was expecting 40-50 lines of perl code, he was happy to get the short answer and did not hold internet research against me. In short, don't re-invent the wheel but do let the interviewer know when you have stolen/borrowed code from elsewhere. – doneal24 Jul 7 at 19:07
  • It depends a bit. Sure, it's always good if you can show them that you find applicable libraries that you could use as part of a solution. However, sometimes what they are interested in is how you code when you need to code something on your own, i.e. to check coding style and whether you understand potentially complex problems. While they shouldn't hold using a library against you (unless they specified not to), it may mean they cannot see what they wanted to see, and will either guess whether you fit what they want or have to schedule another task/way to figure that out. – Frank Hopkins Jul 7 at 21:22
  • yeah. I've only had one coding test during an interview, and the only thing available to me was notepad... Doesn't really create an accurate assessment of the candidate's workflow. – jwenting Jul 8 at 4:34
  • 2
    Also make sure you know what License the code you are borrowing is under otherwise you are potentially a few hundred thousand dollar detriment :) – lucasgcb Jul 8 at 9:25

One thing that you must check before you use open source software is the license.

If the company normally releases closed-source software, they will never let you use a program or library that is released under the GPL for a real programming task, because if they did they'd be forced to open source their software too. Chances are that they'd forbid the use of such software even for an interview task.

The best approach is to ask a direct question. As Player One said, they will appreciate your asking instead of assuming. If they say OSS is fine, go for the second question. Something like:

Can I use open source software even if it's covered by a copyleft license, like the GPL, which implies that the end product must be released under the same terms? I realize this is just an interview question and maybe it doesn't matter in this context, but when doing real work I'd certainly have to check with you to avoid potential legal problems.

This will let them know that you understand licensing problems, and that you aren't one of those code monkeys that blindly copy and paste whatever they find on the web without evaluating the implications.

At that point, regardless of what they answer, you have scored a point.

  • 5
    Doesn't this only apply to companies who are releasing software? Many companies write and use software that's never released: banks don't release the software for all the systems they use to manage user accounts, supermarkets don't release the software running on their tills and self-checkouts, Amazon don't release the software running their web site, and so on. In fact, I suspect the vast majority of software is never released! – gidds Jul 8 at 12:49
  • @gidds I might be wrong, but I don't think the vast majority of software is never released. In any case you have a point, and I have updated my answer. – Fabio Turati Jul 8 at 13:52
  • @FabioTurati There's a lot of custom, in-house software running in a lot of places. I mean, depending how you define "software", I alone have written more unique pieces of software than I've used -- lots of little scripts to automate little bits of what I do. – Nic Hartley Jul 8 at 14:19
  • @NicHartley not just small scripts/programs, either. Thinking back over all my jobs, I've only ever written code in 3 apps to run on non-employees' machines; one was a main application, one was small and rarely-used, and one was never released. That compares with around 30 major systems or applications that were only ever run in-house. (And countless other small apps/scripts.) And I don't think my experience is unrepresentative. In-house software is simply not visible in the way that published software is. – gidds Jul 8 at 15:49
  • @gidds In AGPLv3, what counts as “interacting with [the software] remotely through a computer network?” provides the FSF's guidance on interpreting the AGPLv3 (not GPLv3) in some of those cases. See also Why did you decide to write the GNU Affero GPLv3 as a separate license? on the same page. – a CVn Jul 8 at 20:16

Justify and attribute the use of any open source code that you use

What is the line between using open source code and writing the code by your own for completing an interview task?

There's no hard and fast line. It depends on what the interviewer is trying to assess.

A general advise in software development is to use tried and tested code. That's one of the crucial purposes of open sourcing code, i.e. not to reinvent the wheel every time.

However, here writing code is part of an interview task. There isn't a precise Yes/No answer to whether you should use open source code or not. But it tends towards Yes, if you can justify the use of it.

Think from the point of view of the interviewer. They are trying to assess your skills to get a task done. While one of the intent of getting a candidate to write code is to see their ability to write the solution for a problem, it's also an important skill to assess, how well they can identify and obtain pre written code to solve a problem.

There shouldn't be any problem in using an open source library or component, but it would be best to give proper attribution and reasoning why you chose to use it.

It is important for the interviewer to understand how well you understand the problem and the code that solves the problem, instead of writing the code yourself.

However, though process and intent can vary from interviewer to interviewer. You can propose the interviewer about using certain open source components along with the reasoning behind using them. Do it before starting the task. Some interviewers may be precisely looking for your skill to implement a certain functionality and may want you to write the code from scratch.

  • 2
    I think this is good advice. I especially like this line: "it would be best to give proper attribution and reasoning why you chose to use it." There's a major reason for that: Using resources available to you effectively is professionalism. Misrepresenting them as your own work is fraud. There's also a minor reason: in a professional setting, you'd want a record of any external sources of source code for reasons such as license compliance and being able to integrate any updated releases. Showing that you think about such things is valuable. – Josiah Jul 6 at 19:20
  • 1
    I once took one of those online code-editor tests. It was immediately obvious from the "pass" criteria that there existed a closed-form solution to the problem presented. I searched (the terms of the test didn't forbid outside resources), found the formula on Math SE, and put the URL in a comment. Interviewer was happy, I was done in 15 minutes. – chrylis Jul 6 at 21:16


  • If it's more an algorithmic/data crunching task, then probably better show understanding of the algorithm (e.g. tweak it for the specific usecase)
  • if it is an 'show that you can create an whole app' task, then show that you can use preexisting building blocks (open source, or the frameworks the company asked for)

I would specifically ask your new employer this question. In the end, 90% of those tasks are used, so your employer can form an opinion on your skills.

HOWEVER: Every employer might be looking for something different in your task. I know some departments (like core development) are looking for potential candidates to perform very well "from the ground up", meaning they want to see how you are working with an array "by hand" and implement even the most basic algorithms by yourself. They want to assess your knowledge of a programming language even at it's most basic level (which is often considered as the most important the more "techy" it gets)

Other departments want to see, that you just get the job done and are up to date with the latest frameworks, open source solutions and the standard library and would probably count some things, that aforementioned department would have counted as a plus, as a big minus.

Some companies are just pretty old school by nature, some companies are all about modern solutions. The problem for you is, you can never know and while you may deliver a solid, reasonable solution with, or without open source components, it might just be missing, what the company is looking for.

So from my experience, the best way to find out about this and maybe even to catch a few bonus points by delivering exactly what they are looking for is to ask upfront.

Good luck!


Adding to what has been said so far by others that I totally agree with, I would like to point out here that most open source licenses have an attribution clause and/or require you to keep the license information intact for any derived work. As well as you often aren't allowed to promote the software as your own work if it isn't.

So even if you go against any advice given by the other answers, if that open source code is under a license having any of the before mentioned clauses, not disclosing to the interviewer that it is open source in the required way, would be a license infringement and could possibly backfire depending on the employer's view towards compliance.


Ask the interviewer to be sure. But a general rule of thumb- depends on how much code you're taking from the open source library. If the task is algorithmic, don't take something that writes the main algorithm. If the task is to write an app, don't find a version of the app online and take it. If its a framework and you're going to write the actual code of your app (algorithms and display), that's usually fine.

For example, a workplace of mine did a test where they had a few hours to write Minesweeper. Someone once found an entire online version and made minor tweaks. We didn't offer them the job, because we didn't know how well they could program from that. On the other hand, someone else used a widget to display the timer in a pretty way. That was totally cool with us. There's one algorithmically difficult part to Minesweeper (the algorithm to open up adjacent squares efficiently when they click on a 0). They didn't need to get that to its most efficient version, but I don't think we'd have passed anyone who didn't write it themselves.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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