Where Should I Get My Job Interview Code Samples?
crlove asks: "I'm preparing for an upcoming job interview and my interviewer will want to see some code samples. Unfortunately, all of the coding I've done work-wise since college is not only proprietary, but often classified. To be honest, with long days at work and a busy life outside of it, I haven't had much time to code on my own. So, what should I show my interviewer? Should I start working up some code samples? If so, what would be considered sufficiently complex to take to an interview?"
If you dont have time, pay someone on rentacoder.com to write something for you.
Anytime somebody tries to show me a code sample, the first thing I ask them is where they downloaded it from. Seriously, any employer that asks for a code sample has no clue what they're doing. They should put you at a whiteboard with a pen and have you write something on the fly.
If you don't want crime to pay, let the government run it.
You can always "lift" some snippets from here.
DYWYPI?
if your really good you get a hold of their code fix it and give it back to him in the interview - personaly i like the idea of handing the person being interviewed something from the cbfuscated C contest and ask them to take 5 min and tell me what it does - if they know you show them (seen it before) hire them... if they can manage to read it in 5 min and know what it does having never seen it before - hire them.. if they just look at you dumb.. send them home.
but that is my personal view..
'...if only "Jumping to a Conclusion" was an event in the Olympics.'
While it may be standard practice for graphic designers and models to present a portfolio of their work, it is typically eschewed by the technical community during interviews. What kind of prima donna company wants you to submit this sort of thing?
Even if you were to work up some code samples, how would they know whether these were something you wrote recently or something you wrote a long time ago? I have tons of old Perl code that is written as well as anyone could possibly write it, but I'd be scratching my head for half an hour if you asked me about it in an interview. The code is just so old that it isn't relevant to what I do anymore.
If they want to know how you program, they will ask you to beat out some code during the interview. If they ask you to submit code samples, send them to SourceForge.
I'm assuming so, but you could just show up with the Linux kernel or the Firefox source. Failing that, grab the FreeBSD source code and change all the varible names to some version of 'foobar'
kill all the fucking niggers
If you do, then you either provide some modules that you have written, or cobble up modules that work in a similar way, but which do not break any confidentiality agreements you may have - in other words, desensitize the code, and make sure you can explain the problem (in generic terms) and the solution that you chose (and why).
I'm surprised that anyone today is asking for code samples, unless they are looking for some esoteric language that you are expected to know before you start work for them - if that is the case, the ability to explain the problem, and the way you solved it, with demonstrative code that supports your explanation, would probably be the best approach IMO.
Will those of you who think that you know what you are doing, get out of the way of those of us who know what we are doi
If they are asking you for code samples, are you sure you really want to work for those people?
...you could show up at the interview wearing a ski mask, wearing gloves, use a voice changer, give them a URL to the code up at pirate bay and tell them you only want to be paid in e-gold.
and that you won't be coming into the office very much...
Tell your employer that it is all classified. There is really nothing that you can do about it. It would be a breach of contract and could leave you in legal jeopardy if you showed any of it to him...
But the TSP has a solution. Tell him that you will code for him if he can give you a terse, yet challenging assignment. This will let him see what he wants to see (i.e., what he wants to test you on), and you're willing to take out a bit of your time just to show him that you're a hard worker. This strategy worked for me and landed me a job in the upper 80's!
10 rem My first program... :P
20 print "HELLO, WORLD!"
30 goto 20
pseudocode
...they ought to give you a problem to solve and expect you to mail in the solution, something like 'ok, let's coordinate, sat morning at 8am I'll send you problem xyz by email, you mail back your code by 5pm, we'll discuss your solution during your follow up interview'.
There's no way that a prospective employer can reasonably expect to be able to look at your current production code, and if they do and they expect you to bend the rules of your current NDAs I'm not sure it'd be somebody I'd want to work for anyways.
-- the cake is a lie
Experts Exchange is well known for its well written, bug free and easy-to-read code samples. You should give it a try!
are you a front end engineer? I'll hire you right now!
(only half joking)
Everyone seems to be in agreement except for a straggler a few posts down from here. Companies that ask for code samples are bozos and you don't want to work for them. But why?
The answer has to do with corporate culture. Companies are made up of human beings and each one has different goals and needs and personalities. Some people get along famously while others will tear each other apart if left alone in the same room. Some people are very friendly and easy-going, others are hard-edged and driven. The type of people you hire will determine the culture of your company.
Do people have fun at your company? Are they tired all the time? Do you have high rates of turnover? Do people think they work for the greatest company in the world? The worst? Do people dread meeting with other employees? Do people have a great time pounding out ideas together? Do people focus solely on their job position? Do people look at the company as a whole and see their role as a part of the greater whole? All these things are determined by the type of people you employ.
The type of people you employ is determined by your interview process. If you make the interview process a relaxed one where the interviewee has the chance to articulate his thoughts well, you'll get one kind of employee. If you make the interview process a difficult, high pressure affair, you'll get another kind of employee. If you ask them to submit code samples, you'll get people who are either incredibly anal or look for shortcuts. If you ask them to code on a white board, you'll get people who can think on their feet.
No one type of company works best for all situations. You wouldn't want cowboy coders in the bank software business. OTOH, you wouldn't want incredibly anal people working on next-generation UI stuff. But the type of people you hire is not only indicative of the culture of your company, it is a clue as to the personalities of the people working there.
Another problem with the code sample thing is that it shows that the company values code quality over quality of character. My cousin BasementDweller78 is a wiz at coding. He can drop his pants and shit better code than I ever could. But he's a complete asshole. He isn't pleasant to be around. He's your prototypical computer geek. He's also the one that will get hired at a company that values code over people.
So when some company asks for a code sample we all react with our gut and run far away. It's because we don't want to be around the type of people who would judge us on inanimate code. We'd rather be judged as humans and don't fear whiteboards nor do we lack confidence in our programming abilities. We are just a certain subset of all programmers. Those who value a pleasant working environment. Pleasant for us, that is.
Instead of waiting for them to ask, tell them that all of the work you've done has been proprietary and that you don't mind doing a simple theoretical project to show your code style. I did that and it got me the job. Later the guy told me that it was that initiative (and the completed code) that convinced him to choose me.
Good luck.
i had a few interviews fresh out of uni. One place gave the final 3 applicants a puzzle to take home and solve based on a real-world situation, though no "code" was involved, we were asked to provide simple pseudo-code.
I thought that was odd as we could all go to external sources or each other.
The next place asked me in the interview "What can you tell me about this code? Problems, inefficiencies.. anything?". I thought that was a much better idea. Plus who wants to write code up on a white board when all nervous in an interview anyway right?
the point is for you to be able to explain your code to someone you might be working with. Can you explain it clearly? Are you enthusiastic about it? Find something that was fun in college; maybe something you could talk about right now if you had to. That's where I'd start. BTW, Google does code reviews.
float InvSqrt (float x){
float xhalf = 0.5f*x;
int i = *(int*)
i = 0x5f3759df - (i>>1);
x = *(float*)
x = x*(1.5f - xhalf*x*x);
return x;
}
Just keep an eye on past and current projects for ones that are reasonably self-contained (there are always a few gems that you write while working) and then go home and reimplement it on your own hardware and on your own time. It is perfectly acceptable to use a code sample like this for interview purposes, provided that proprietary information is not present. I have several samples from the past few years which are loosely based on insights that I gained during particular projects. I went home and reworked them into a sample, and it is very fast to do this because most of the thinking work is already complete and you have all of the details in your mind.
You typically sign an agreement that says work that you do on your own time and hardware without any of your previous companies resources is owned by you. Thankfully, companies do not own the knowledge and experience that you gain while working for them. That is yours, and you are free to display it. Indeed, no one would hire any software developers if it were otherwise.
It's probably too late for your "upcoming" interview, but if you donate some code to the odd open source project here or there, then you have something you can be proud of -- especially if the prospective employer uses the stuff you helped to write.) Many projects list names of contributors in a "credits" or "release notes" file, which gives you a way to show that the code is yours -- instead of stolen from someone else.
Just ask them to sign something saying they won't use it or you'll sue em. That will impress them and know that they can count on you not to show off any code you write for them and show off the coolest stuff. Either that or show a simple example of how you fixed a common problem that other programmers leave in most programs and be able to explain how you thought of it and why you implemented it as well as have an example of another popular program that didn't fix the problem (preferably from Microsoft.) For example, if you found a way to sync up the highlighted line between multiple bound listboxes to eliminate the delay between the mouse down and mouse up (I'm even still working on that one) and you show that then there ya go. They'll be impressed that it's yours, it's smart, supposed professionals leave it in their programs, and there's a decent reason for it...though you could find a fix with a better reason than "it looks prettier" like with the listboxes. Btw if you do fix that listbox problem, send me to code too lol.
Google's Super Secret Search Algorithm: SELECT @search_results FROM internet WHERE @search_results = 'good'
Google, of course.
Plus, you stole my response. Right to the letter. Kudos, you must be a manager, if not then you should be.
--- Grow a pair, liberals... stop letting the Republicans bully you!
- The level of coding question to ask them during the interview.
- The quality of what they think their best code is. We've all worked with people who were smart enough to solve whiteboard problems but wrote unmaintainable garbage when it came time to code.
- What they claim (emphasis on claim) to be able to do. If there's a discrepancy with the skills at the whiteboard, then it's feedback for the next person interviewing to probe deeper. Either we're catching the person in a lie (valuable information) or s/he's one of those people that just don't do well standing at a whiteboard, in which case we do it a slightly different way.
I don't think anybody is advocating code samples as the sole factor in deciding to hire. It's just a valuable piece of the bigger picture.10 PRINT "Give me a JOB!" 20 GOTO 10
I wanted a job in a company, so before my interview I, personally, hacked their website.
:)
Found several holes in it to be honest...
So, I let it slip during the interview, hehehe...
Long story short, I got what I asked for and my first project was to do a security assessment on all
the sites they had built.
Ofc, I could had been prosecuted, but you gotta take some risks.
A small test is used at the company I work for. Since you always have signed big NDA's at your old job a small test does the trick, no longer than a page with sample code that has some error in it and some questions. The errors are typically pointer stuff and such but some are quite tricky.
Just a thought.......
My solution still needs three pointers/indexes, though.
Pull it our of your asshole where you and Slashdot get the rest of your programming skills from.
Call your interviewer ahead of time and tell him/her the same thing that you just told us. Offer to work through some technical problems during the interview so they can see how you think. Most people in the business world (that you want to work for, anyhow) are sane and would understand your situation.
I have never been asked for code samples as part of an interview. Probably because the vast, overwhelming majority of code that people get paid to write is either proprietary, classified, or both. Seems a strange request in this day and age where people could just download some code and hand it in.
"Avoid employing unlucky people - throw half of the pile of CVs in the bin without reading them." -- David Brent
I can't understand why a company wouldn't insist on looking over prospective employees before giving them a job. The company I work for is big on integrated systems and code re-use - if we write something once we try to use it whenever we need the same functionality again. Depending on the workload at the time, we'll work as a single team, a handful of smaller teams, or individually. We're also expected to be able to bugfix problems quickly in our own projects or projects by other developers in the company.
All of this means that our code absolutely must conform to the house standards - naming conventions, DB designs, project layouts, comments, everything. If a project breaks the conventions because the developer did a half-arsed job and we need to fix a bug, we'll spend a lot more time trying to understand exactly what he thought he was doing before we can fix the problem.
Code samples let us see exactly what sort of code an interview candidate produces. If his code is a mess - no comments, no formatting standards, inconsistent naming conventaions - there's little point in us employing him. It is vital to work out if a programmer is competent, but it's also imperative that we know the guy won't produce incomprehensible spaghetti code.
Database designs are even more important. Given the choice I'd insist on seeing a sample of the candidate's DB work, and if I saw a crap database design the interview would be pretty much over. Maybe you can bodge your front-end and business layers, but if the DB's wrong then the data isn't worth very much.
If I weren't doing tedious business apps, though, my attitude would be different. If I were interviewing for a games company, I wouldn't care too much about code re-use; I'd just want the guy who showed me the coolest algorithm.
Having been the interviewer....
I don't ever remember asking for or getting offered code samples. Ever.
If it's short, it's out of context or trivially simple. If it's long, I'm hardly going to read it in an interview.
The first problem is do you understand code. I'll show you some mediocre code with pre installed problems and ask you to comment. Any companies bug database will point you to plenty of samples. I don't expect you to spot everything in an interview, but if you don't spot something important then I'll ask about it. If you are still looking blank, I'll try to comunicate a little more clearly. I may even explain the problem and see how you take it in. If it's a junior position then I want to know about your capacity to learn.
From then on, I want bigger pictures than code. Any monkey can write a loop, hell most integrated environments will template it out for you. Fill in the blanks coding.
I'll give you some design problems and ask you to comment. Often I'll leave you missing some key information to see if you realise that you need to ask some questions, or if you are the barrel along regardless type.
http://davesboat.blogspot.com/
How about showing them some of the code that is proprietary but not classified?
I never get asked for code. I have code samples all over usenet and in an open source project. Though it's probably a good thing that I've never been asked. It's mostly experimental prototype code and even I can't understand it if I haven't worked on it recently. A word of advice. Stay away from the advanced stuff. There's maybe 10 people in the world that actually understand stuff in the esoteric area I coded in. If they were hiring managers, I'd have it made. But they're not, so as far as real hiring managers are concerned, it really is spagetti code.
So pick something real simple that will demonstrate some clean design and coding principles. It will get complicated enough as it is.
However this is a good reason to have considered (at least considered!) doing a bit of work for an open source project. There are lots of them on SourceForge (and many other fine places) begging for help. A few bits added in make nice examples you can point to when asked for code samples. I know, it seems like a huge time investment that you don't have, but it really doesn't have to be. Further, every little bit helps the project guys.
In the time that it's going to take for you to read all of these responses, you could have sat down and written some code that will impress them. They're not looking for your magnum opus... They want to see stuff that shows you can understand a problem and translate your understanding into compilable syntax. In fact, they probably don't even care about compilable syntax. Think of a cute hack and write it instead of reading slashdot. Take it in and say "I can't show you any of the code I've written professionally, so I wrote this last night. You can confirm with google that I didn't download it from anywhere if you like, or you can ask me any questions about it and I'll be happy to answer them." Don't pick something related to the companies' core business. They understand their problems _way_better_ than you do. Second, decide whether you want to work for a company that quantifies you based on your code output. I'm a coder and I only spend about 10% of my work time actually writing production code. The rest is hacking test cases, prototyping, designing, staring at graphs, and attending team meetings.
For eln's delecate sensibilities about perl...
echo "this is a sentence" | awk '{ cnt = NF; while ( cnt > 0 ) { printf( "%s ", $cnt ); --cnt; } printf("\n"); }'
Happier?
-- Terry
[somebody has to deliver the punchline]
I was asked for a code sample only once. More common was to email me a quiz that involved a simple coding problem. But even that was fairly rare, as most companies just did a quick phone screen and got me to whiteboard stuff in interviews.
What I did when I was asked was simply state that all my relevant work in the language they asked for was done for my current job, and thus I couldn't disclose any of the code to them in good concious. I then asked them if, instead, they would like to give me a simple programming task that I could write up for them. They were very flexible, and agreed. In the end, I was told that this made an impression on them because it not only showed them I was able to accomplish a simple task in the target language, but that I also respected my employer's intellectual property.
"Avoid employing unlucky people - throw half of the pile of CVs in the bin without reading them."
Whose luck are you measuring, the candidates or yours?
I go through tons of applications looking for qualified people. It would be my luck to discard the one or two who actually know what the position they applied for is.
I only look human.
My mother is a halfling and my dad is an ogre, so that makes me an Ogreling
I had a job applicant once who had on his resume that he "wrote the Win32 subsystem".
We asked him in just to see what kind of a tool he was. He might as well have put "discovered the element Protactinium" on there...
He never showed up for the interview.
There seem to be a lot of people that think code samples are useless, but I disagree. A sample still serves a useful purpose, it just can't be the entire basis of hiring or not. I ask for a code sample just so I can see if they have a style that will fit with the rest of the group. I want to see comments, I want to see some damn whitespace, I want to see variable names that make sense, and I want to see that things that should take three lines aren't being done in thirty. This isn't where I decide if they know what they are doing, I still ask them to interpret some of our code and find a couple of planted bugs, and I ask questions that only someone who used the language on a daily basis could answer.
I know I can only hope they are being honest about it being their own code, but that's no different from the rest of the interview process, where you just have to have a finely tuned BS radar. If you're in doubt, asking a few questions about why they did this instead of that or what the purpose of this or that section was will weed out a lot of posers. If they pass off someone else's code and then start handing me work that looks like it was written by a monkey, they're going to have a very, very bad time.
In short, I would just tell them that all your recent work is classified or otherwise proprietary. Any reasonable employer should understand that and adjust the interview appropriately. If they make a big deal out of it, they are probably pricks that you don't want to work with anyhow.
If they request code samples, then they are anal and you don't want to work for them (as others have stated), or two, they are looking to see if you lift code from another source. Depending on the company, that can be either a good thing or a bad thing. If they are an ethical company, and they find you lifting code, then you are toast. If they aren't an ethical company, why do you want to work for them?
Either way, if a company asked me to bring in a code sample, I would cancel the interview, since obviously, I don't want to work for them.
Oh, and ANY code I worked on for previous employers is not my property, and to display it to someone else is violating the no compete clause I may have signed when leaving the previous company, or with my current employer.
In many job interviews over the last 25 years, not once have I been asked to show "code samples". With one company I was asked to take a basic programming test, but that only took a half hour. (Stupid test, they had an invalid question on it, where the correct answer would depend on the setting of a compile time switch in several languages).
The purpose of a code sample isn't to check your understanding of complexe theory, or your ability to whip out amazing code. It's a quick quality check. I ask for a code sample usually, not to check for skill, but to check for finish. Are variables named appropriately? Are methods and members appropriately commented? Are stack limits checked? etc... nothing real fancy, just a quick snippet to make sure the coder can produce maintainable code.
I think the last time I handed someone a code sample it was a very simple contact list app. Nothing more than a hand full of textboxes and a tiny data layer that talked to Access. Took maybe 4 hours to write. There was nothing fancy or impressive in the code, but I spent the majority of the time making sure that the code was consistantly written and inline with most industry standards.
-Rick
"Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
Wrong. The fact you are working on classified work is not in itself classified, though it may be considered sensitive, in that if you reveal that fact to anyone, you may be making a target of yourself. The actual "contract" you sign regarding the classified work is NOT classified, including abbreviations that represent particular clearance codewords (though actual codewords are classified, generally only at secret level).
So how do you eat if nobody in town loves Perl?
Then set up the API so that each element of the string represents a word. Chinese in UTF-16 does this ordinarily, and there are at least a few data compression programs (e.g. "huffword") that use this as an intermediate representation.
Until you bust out Haskell# or Lisp#. There are plenty of languages that run on the .NET framework and on the Java virtual machine.
This code produces incorrect results on all input strings except "denied permission exec: SecurityException:" or "found not command perl:" or perhaps "name file or command Bad".
Disclaimer: I have a lot of trouble getting interviews, so I've only tried this out once or twice.
When someone asks for a code sample, show some interesting bugs you've fixed.
My personal favorite is a place where someone strcpy'd into a buffer gotten from malloc(strlen(src)) (bug: 1 should be added for the terminating null), and the bug only showed up when the string's length was an exact multiple of 16, because the platform's malloc() implementation rounded allocation up to multiples of 16. Oy, that was a tough one to track down.
I've also seen and whacked a depressingly large number of instances of strcpy(foo, NULL) in my current day job (the clueless attempting to zero out a buffer). It doesn't necessarily have to be a full-on WTF like that, though.
Usually these kinds of things can be generalized enough that they don't really reveal anything proprietary.
You forgot to hyperlink it
ExpertSexChange.com
You'll find time to write some code to show them, eh?
I hope that's all they want. Thanks.
I'm just worried about a line in the email saying "It is highly encouraged for you to bring sample work as this is an important part of our interviewing process. "
I mean, what the hell does that mean?
Unless they specificly said that they want to see a sample that shows your understanding of x, y, and z, that is exactly what it is.
Exceptional code may be worth its weight in gold, but maintainable code is worth its weight in diamonds.
Comment your code blocks, ensure proper indention, use hungarian notation for your variable names (or any standard, just be consistant through out!), etc... Clean, ledgible, and easily understood is the key to a good 'demo' app.
-Rick
"Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
Were I to interview a developer, I would ask to see 5 very short, but very different code samples. I would look to see that there is a consistency between all 5 of them in terms of scoping, declarations, comments, and even simple things like indentation and whether or not they consistently stick to studlyCaps or whatnot...
IMO, coding is exceptionally easy - it's all just functions, declarations, conditions, and loops. It is the ability to code CONSISTENTLY that makes one coder better than the next.
The reason they are asking you for code samples is so they can see if you would actually take the IP of the company you work for and show them.
Basically they want to see if you are HONEST and will abide by an NDA, or are you only interested in yourself and would be willing to steal code from your current employer.
Ive been in this game for 16 years, that is exactly what they are doing.
Thanks, you (and everyone else here at ./) have been a big help. I think I've got enough to work with :)
imho, if i were an employer i wouldn't hire anybody that said all their work was classified. a programmer is worthless unless they actually took enough interest to do *some* amount of coding OUTSIDE the job.
Write a project document, including a design, use cases and test plan for a straightforward program. You could even write the interfaces for them (classes, methods, etc in java speak) but don't bother actually coding it except perhaps for a method or two. If you can show that you know your stuff well enough to get to a decent design then you're better than half the monkeys coming out of university these days.
Wouldn't this be bigger?
It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
When I was asked for a sample how I code, I brought in my project code ( all of it ) from a data structures class I had just taken at the local college.
I was working on proprietary stuff at work, but I felt the class stuff was general enough - as from the talk we had, I felt he just wanted to see if I wrote clean maintainable code. I could really see where he was coming from, as I have seen other classmates work, and would have been extremely miffed if someone handed the mess to me in exchange for a paycheck. Not many of us wrote clean code. ( Or, at least it didn't *look* clean! )
Turns out I did not get the job, but it was for other things. I didn't really wanna get into pure coding, aa my love is designing physics gizmos. The job was pure coding.
I can't blame an employer one bit for wanting a sample. Badly written code may be coaxed into working, but trying to modify or debug badly written code is a nightmare. Its often best to throw the whole damned thing away and start over.
"Prove all things; hold fast that which is good." [KJV: I Thessalonians 5:21]
I ahad someone do this to me once, I took a look at it and knew immediatly what it did so I told them straight off.
They were unhappy that I didn't 'Walk the process'.
I told them its 8 lines of code, 4 of them that just defining variables. If someone needs to sit down and think about it for more then 2 seconds then they are not principle material.
Needles to say they didn't call me back; Which was fine since by that time I could see they weren't exactly the sharpest knife in the box.
FUnny thing is, I had worked with the guy they hired before, and the y certianly got what they deserve.
The Kruger Dunning explains most post on
Computer programming is too large and too difficult of a subject to learn merely at work. If you're not programming in your off-time, then you probably don't feel very strongly about the subject of computer science. I'd say there's a good chance you care more about the size of your paycheck than you do the quality of your code. I'd also say there's a big chance your skills lack depth. You're the programmer that finds it hard enough to merely get something to work; when asked to improve performance, or to make your code run on multiple non-symmetric processors, I'm guessing you get the "deer-in-the-headlights" look in your eyes.
My favorite interview question, to ask and be asked, is "Show us a piece of code that you wrote, that you're proud of, and explain to us what it does and how it works." That tells me everything I need to know about a programmer.
So what about the ability to get along with others, you ask? Not surprisingly, I say "bollocks" to that. This recent trend of caring more about people's feelings than their brains, ethics, or effort, is a stupid idea that has nothing to do with actual accomplishment or success or anything else, and anyone that subscribes to it is doomed to a downward spiral of irrelevance. You accomplish nothing by getting along fabulously as you run the company straight into the ground. If you're unclear on why, there's a famous book that explains it in voluminous detail.
"Once we've identified and embraced our sickness, we'll have strength...and that's when we get dangerous." - John Waters
Interesting experience at MSFT. As all my work was primarily as a contractor and I was interviewing as a contractor I asked if they would give permission for me to use as future samples code I wrote for them. They understood the issue a bit better then. I did spend 3 of the interview sessions (MSFT can be brutal with all day interviews with loads of people) writing code on a whiteboard. The seemed to focus on approach and problem solving skipping being excruciatingly exact (every semicolon in its place, etc.) in favor of a solution that would work. Some of the tasks did not take small amounts of code. However, the simplest was you read n items off disk and you want to write them back sorted. I just used an appropriate STL construct to store them and iterator to go through on write. I didn't know the MSFT STL was pretty broken at the time. When asked for an alternate solution, I replaced the STL code with a "sort(input_array, output_array_pointer)" When he asked what the sort routine was I just commented "probably quick sort unless there is a compelling reason to use another, and every development environment or OS has one that has been painstakingly optimized, so just adjust it for the Windows flavor of invocation. Why bother reinventing something already done well." Apparently that caused some discussion, but they hired my services anyway.
- Tjp
I am in wallow with my inner money grubbing capitalistic pig. ... Oink!
My previous job was the first time I'd been asked to submit a code example. The interview focused quite a bit on object oriented technique, and they told me that's what they'd like to see in my submitted code.
As it happens, the best example of OO technique I had done at that time was a version of Tetris I had programmed during my down time at my then-current job. I checked with my recruiter to get his opinion on whether or not it would be appropriate, sent it in, and got the job.
Don't think that your code needs to be related to the business of the job you're after, or really even business related at all. Interviewers are just looking to see that you have the ability you claim.
Who modded this troll? It's hilarious! Go find something better to do with your mod points.
Make love, not sigs
You can certainly intimidate someone into signing a document like that, and can threaten to take them to court (and thus possibly get what you want), but it will not hold up if it goes in front of a judge. A company can put a competitive business clause into a contract and you are held to that, but even here the company must stipulate a realistic timeframe. If companies were allowed to enforce a clause that says, "We own all of your IP now and in the future, whether employed by us or not, whether related to our business or not, in perpetuity," the economic and civil liberty consequences would be disasterous.
Anyway, I'm not a lawyer. Then again, quite a few SCOTUS judges including at least one influential head justice were not lawyers or judges. Laws are made by and we are held accountable to them by the people.
It does really sadden me however, that most citizens can no longer go to the courthouse, state their case in plain English, and have a reasonable expectation of a fair outcome in the face of highly-payed, well-educated, corporate lawyers that can navigate through the legal morass that our judicial process has become, and have the training and the money necessary to persuade and manipulate a jury to achieve their desired outcome.
That said, these are just my opinions, but if someone tried to do this to me, I'd get myself in a court, represent myself, and make a simple statement of what I believe and what the situation is, and see if I'm right. And anyway, this is pretty far afield of the original question which talks about sample code. Most people are careful (and all should be) to choose sample code which has no commercial value (in other words, it is just a confirmation of your technical capabilities). Would you bring a piece of sample code to the interview table that could be very lucrative? I hope not; go sell that product yourself. Therefore, if your sample code has no commercial value, it is not "property" and is not in conflict with the IP clause of your employement contract.