Thread: Submitting a Code Sample to an Employer

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    204

    Submitting a Code Sample to an Employer

    Has anyone done this? I have a wonderfully complex algorithm that I wouldn't mind submitting. It's comprised of 11 source and header file and contains around 700 lines of code, plus a makefile. This is my most sophisticated from scratch algorithm, though it's very far from perfection. It would probably take me another week to polish it up, but I have doubts that even after polishing, that it will reach the state of perfection. Has anyone dealt with the issue of what type of code sample to submit to an employer? I'm trying to get into an interdisciplinary field, that would closely resemble computer science...you might say scientific programmer. While I feel like I'm a good scientific programmer, I'm not sure that I'm a good programmer.

  2. #2
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    I've never had any company ever ask me for any sample code. They usually just ask me questions or give me a simple test to complete.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by thetinman View Post
    Has anyone done this? I have a wonderfully complex algorithm that I wouldn't mind submitting. It's comprised of 11 source and header file and contains around 700 lines of code, plus a makefile. This is my most sophisticated from scratch algorithm, though it's very far from perfection. It would probably take me another week to polish it up, but I have doubts that even after polishing, that it will reach the state of perfection. Has anyone dealt with the issue of what type of code sample to submit to an employer? I'm trying to get into an interdisciplinary field, that would closely resemble computer science...you might say scientific programmer. While I feel like I'm a good scientific programmer, I'm not sure that I'm a good programmer.
    First, will the potential employer have time to read and comprehend it? Being impressive is good, but being impressive and terse is better. Another huge consideration is, if you are hired, you may find that this code ends up the property of your employer and you lose control over it. I personally keep my favorite creations to myself.

    In fact, I have one of those contracts which basically says "Everything you think, 24 hours a day, is property of The Company." I have to be extremely careful what I reveal or I risk losing my own assets.

    Just think it through and be careful.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by brewbuck
    Another huge consideration is, if you are hired, you may find that this code ends up the property of your employer and you lose control over it.
    That sounds unlikely if you assert copyright over the code since you wrote it when not under your would-be employer's payroll.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by laserlight View Post
    That sounds unlikely if you assert copyright over the code since you wrote it when not under your would-be employer's payroll.
    Not that unlikely.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    No, the circumstances are very different. Here you would be asserting copyright even before entering employment, thus the tangible expression of your idea is available for inspection (and for registration, for that matter). Of course, if you copy or rewrite your implementation into company code then the company would own that copy of the code, but that's too bad and is entirely your fault.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    Registered User
    Join Date
    Aug 2005
    Posts
    204
    Quote Originally Posted by brewbuck View Post
    First, will the potential employer have time to read and comprehend it?
    If they read it, it is highly unlikely that a talented programmer or scientist would know what was going on -even if the code was beautifully written.

  8. #8
    Registered User
    Join Date
    Aug 2005
    Posts
    204
    Quote Originally Posted by cpjust View Post
    I've never had any company ever ask me for any sample code. They usually just ask me questions or give me a simple test to complete.
    I've been asked for sample code. One thing though, is that my coding ability goes both beyond what was taught to me in school and beyond anything I've done professionally. I've also been given tests in the past, some of which were not the least bit comprehensive. Sample code might be something that I could volunteer.

  9. #9
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743
    Is this for a job interview?

    99% of the time if it is for a job interview than they just want to see how good your code looks, in other words: do you comment your code and indent nicely.
    My Website

    "Circular logic is good because it is."

  10. #10
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I think they will probably be looking, if at all, for consistency. Consistency is very important. The length of the code or what it does is not nearly as important as how it looks (consistency falls into this as well) and how easy it would be to maintain. Are you throwing globals around everywhere or is the piece nice and tight and contained? Maintenance costs a lost so if you prove you can write easily maintainable code it will look a lot better than throwing them some super confusing uber algorithm. I'll take a loosely coupled piece any day over something that is so tightly coupled it takes a jackhammer to remove it.

    I doubt they will have much time to really look at it but they may code review it and send you suggestions to see how you handle constructive criticism. Some want to defend their code at the first sign of criticism which is not a good trait and a huge red flag for me. You can learn a lot from most code reviews. Some of the suggestions you will agree with and some you won't but either way you should have good solid reasons for agreeing or disagreeing. Sometimes its not a matter of agreeing as much as this is how our company does A or B and we want our devs to follow suit.

    It's always good to have another pair of eyeballs looking at your code b/c in the end we all make mistakes. In the end if the suggestions improve the quality and maintenance factor of the code or if it's a matter of following the way it's been done thus far then you would want to heed the suggestions rather than insist on your own way. All of us put our absolute best efforts forward but none of us write perfect code and code reviews are not there to put you down. They are used to help you as well as to be the first line of defense for possible bugs or later maintenance nightmares.

    Most of your knowledge will be tested in the interviews. I doubt seriously that any place would choose to hire/not hire simply based on what you submit unless it is so ugly that no one can understand it...which I doubt it is.
    Last edited by VirtualAce; 11-15-2008 at 10:15 AM.

  11. #11
    Registered User
    Join Date
    Aug 2005
    Posts
    204
    Quote Originally Posted by DavidP View Post
    Is this for a job interview?

    99% of the time if it is for a job interview than they just want to see how good your code looks, in other words: do you comment your code and indent nicely.
    More or less for a job interview. I'm trying to get into a field that involves programming. I put some comments in my code (enough so that I can understand it a year later), and everything is indented. I'd just like to have something nice on hand in case a potential employer asks for a sample. Also, because I have little formal training in computer science, and my job requires very little programming, I'd like to be able to voluntarily send some nice looking code to a potential employer. Since I already have a full time job, it would preferably not be some big algorithm that takes weeks to writes.

  12. #12
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by brewbuck View Post
    Just write "Copyright <your name>, <some year> All Rights Reserved." at the top of all your source files.

    If some court chooses to act illegally, then I would find THEM in contempt of court and ignore any ruling that they spewed out.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  13. #13
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    just writing a copyright notice is useless.
    If you signed (implicitly or explicitly) a contract releasing ownership to the company that's that, the copyright is now owned by that company.
    And if you don't agree to such a clause, most likely you won't be hired anyway.

    Of course any company requiring candidates to send in samples of their work isn't likely to get the coders they think or want to get.
    A lot of the code they will get sent will be pilfered from the internet or books, a lot of the rest created on purpose with express intent to be as nice looking as possible (maybe even created by others for pay rather than by the actual candidate), and thus won't reflect the abilities of the candidates except their ability to plagiarise and defraud others.

    Code written on-site with the hiring company by the candidate during the interview process is a better gauge, but given the stress the candidate is under while writing it it's unlikely to be a representative sample of what he is capable of producing under normal conditions.
    Most hiring crews don't take that fact into account however.

  14. #14
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by jwenting View Post
    just writing a copyright notice is useless.
    If you signed (implicitly or explicitly) a contract releasing ownership to the company that's that, the copyright is now owned by that company.
    And if you don't agree to such a clause, most likely you won't be hired anyway.
    But that's only for code you write while working at that company, not stuff you wrote in the past (well unless the contract is seriously messed up, in which case I'd tell the company where they can stick their contract).
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  15. #15
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by cpjust View Post
    But that's only for code you write while working at that company, not stuff you wrote in the past (well unless the contract is seriously messed up, in which case I'd tell the company where they can stick their contract).
    And I doubt that unless you are specifically paid for such "previous work" and it's code that you have actually written as personal development, it would actually hold up in court. Certainly, a new employer would not have the rights to code you wrote for a previous employer - it wouldn't be yours to give away (or sell) anyways. And if they are hiring you to get access to code you wrote before they hired you, then they should really pay you specifically for that.

    Obviously, this doesn't mean that the company can't put in the small print for the solution that the code you send will henceforth belong to them, just like many photo competitions allow the competition company to use your photos "in any way it likes, whether you win or not" - a good way to build up a large library of stock photos on any or all subjects...

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can't get sample shell code to work...
    By jcafaro10 in forum C Programming
    Replies: 6
    Last Post: 07-07-2010, 08:04 AM
  2. Pre-Interviewer asking sample code
    By jayee_spicyguy in forum C Programming
    Replies: 3
    Last Post: 02-09-2009, 11:21 AM
  3. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 04:28 AM
  4. stricmp() where can I view the sample code?
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 06-28-2002, 08:40 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM