45

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
  • 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. Jul 8, 2019 at 19:42

7 Answers 7

110

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.

2
  • 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, 2019 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, 2019 at 17:06
12

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.

7
  • 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, 2019 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. Jul 8, 2019 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.
    – anon
    Jul 8, 2019 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, 2019 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.
    – user
    Jul 8, 2019 at 20:16
3

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
  • 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, 2019 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. Jul 6, 2019 at 21:16
3

Depends:

  • 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)
2

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!

0

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.

0

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.

You must log in to answer this question.

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