2

Many organizations ask for sample code but one is actually asking for source code from previous projects. Unless the previous projects are owned by the engineer, isn't this unethical? Isn't that code owned by the previous employer?

7
  • 2
    Yes it is. You can change it enough to make it not their code though if you try.
    – HLGEM
    Commented Jun 5, 2014 at 21:17
  • 6
    This question appears to be off-topic because it is about judging the ethics of an employers request not solving a problem. Commented Jun 5, 2014 at 21:28
  • 1
    Gigi is providing you with a very good answer, so I'll just comment. If you had developed this code for your previous employer and you had turned over this code to your previous employer, this code is not yours. Even if your previous employer open sources all its code. Obviously, if the code is Open Source, you can point to where you contributed. Most likely, you signed an NDA with your previous employer. If you disclose the source code to anyone, that's most likely how your previous employer is going to get you. Tell your prospective employer that you signed an NDA (No Discosure Agreement) Commented Jun 5, 2014 at 21:41
  • Short answer - no. Your previous employer paid you to produce code for them and have a right to expect you not to pass this onto a third party.
    – Robbie Dee
    Commented Jun 5, 2014 at 21:52
  • 1
    Do you own the source code from your previous employer, or have their permission to share it? If not, then ethics aside it is not legal for you to share it. In terms of ethics, I think that depends more upon exactly what the organization is asking for, and why. And on how you comply. If they want the core of some successful software project so that they can basically rip it off, and you give it to them, that's unethical on both parts. If they just want some example code, and you give them something that's completely useless as anything other than an example, that's fine on both parts.
    – aroth
    Commented Jun 5, 2014 at 23:49

4 Answers 4

20

As far as I can tell, keeping (let alone sharing) source code from a previous employer is illegal, and you can get in big trouble for that. In fact most contracts of employment are well rigged against theft of intellectual property, and once you've signed such a contract, then you're screwed big time if you are caught violating it.

I'm not sure whether this organisation is asking for source code from a previous project (as your question states) or from a previous employer (as your title states). If they're asking for the latter, I think that's very unethical. On the other hand if they're asking about a previous project, then you could probably show them something you developed in your spare time. Hence why maintaining public projects (e.g. on github) is an advantage because it gives you something to show - a portfolio of sorts, if you will.

0
4

IANAL:

This is covered under Trade Secret copyright protection in the US (and most countries):

A trade secret is a formula, practice, process, design, instrument, pattern, or compilation of information which is not generally known or reasonably ascertainable, by which a business can obtain an economic advantage over competitors or customers.

It's not just unethical, it's illegal, and you can be sued for it.

This is assuming you were a full-time employee being paid a salary to write code full-time for your employer.

Some freelancers work under contracts that allow them to maintain rights over things they do. If you do not have this, you have implied that you are relinquishing rights to anything you write to your employer. Read your employment contract for more detail.

2
  • NDA. Copyright. Trade secret. That's three ways so far to get in trouble legally +1 for citing "trade secret" :) Commented Jun 6, 2014 at 0:19
  • @VietnhiPhuvan thanks. Other forms include lithographic protections, patents, etc. But that wouldn't apply in this case :)
    – Codeman
    Commented Jun 6, 2014 at 16:51
1

Other answers have addresed the legality aspect, but from another point of view the question is, is this code you wrote yourself?

If so, why do you even need to keep a copy of it? Wouldn't you be able to write code to achieve the same functionality if asked to do so again (and it would probably be better if you have learned other skills since)?

If not, then what exactly do you expect to happen? The code would need to be tweaked and changed anyway to fit with your new employers specific use case, and you didn't write it in the first place so that isn't going to be easy. Not to mention that you don't fully know what it is actually doing. It may be 'phoning home' to your previous employer in a class/module you aren't even aware off, or have serious vulnerabilities in other ways.

The bottom line is if your new employer needs a program that does thing X, and you have the skills to write a program that does thing X, then you don't need the old code. If you don't have those skills, then either learn them, or find a job more suited to your skillset, you still don't need the old code.

Giving your old employers code to your new employer can only end badly.

1
  • All fair points!
    – R Claven
    Commented Jun 7, 2014 at 22:36
-4

You don't have to "give" the source to anyone. The point is to demonstrate it and review it with them so they can see your abilities and ask questions about it.

This can be done by bringing a laptop with you to the interview where you can demo your work and perform the equivalent of a "mini" code review. Some screenshots and design diagrams are a good idea as well. JUST DON'T LET IT LEAVE YOUR LAPTOP. Only the most persnickety rule-follower would find this to be an issue. If you're just involved with the daily grind of corporate code and not some "crown jewels" of algorithm development, it is safe.

I think people get into trouble when they electronically transfer large chunks of code. Once it is out of your hands, you don't know where it will show up and are at the mercy of whomever has it: I am thinking specifically of the debacle with Google vs Oracle (entire law firms making a good living for months out of a few scraps of dull boilerplate code).

2
  • 1
    "Only the most persnickety rule-follower would find this to be an issue." - You may find one day that the legal department of a large corp can be pretty darn "persnickety" as they bring down the hammer. Also, if I was hiring and you showed me some competing firm's code, my immediate question would be "are you going to be demonstrating OUR code like that a few years from now?!?!?"
    – MrFox
    Commented Jun 6, 2014 at 20:43
  • Never had a problem with it. Like I said, run-of-the-mill daily grind stuff, not missile launch codes and this is NOT something that gets transferred into someone else's hands. No need to be paranoid about it.
    – teego1967
    Commented Jun 7, 2014 at 19:14

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