• Advertisement
Sign in to follow this  

What should you send a company that requests code samples?

This topic is 3578 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

A company I contacted for a game programming position is asking me for code samples, in order to see my "coding style and efficiency". What should I send them? Should it be a big 5,000-line project, or would a nice pretty 200-line function suffice? Do they need a complete working program, or can I just send them a couple classes and/or files?

Share this post


Link to post
Share on other sites
Advertisement
Wow, that's some clean code!

Is it very important for the code to be so polished and well-documented?

Generally, I'm the type of programmer that just gets things done, even if I have to use an occasional goto. I suppose that's not what they want to see, is it?

Share this post


Link to post
Share on other sites
Quote:
Original post by Halma
Is it very important for the code to be so polished and well-documented?


It's pretty much the least they can expect...

Quote:
Generally, I'm the type of programmer that just gets things done, even if I have to use an occasional goto. I suppose that's not what they want to see, is it?


This is exactly the kind of programmer who you don't want on your team. Team programming requires the ability to write code which can be understood by your teammates even if you have to spend more time writing it.

Share this post


Link to post
Share on other sites
I see what you mean. But I could be a "horrible goto-using programmer", but still manage to clean up and polish one of my messy codes. So what's the big deal?

By the way, is it a good idea to send them something that isn't open source? Couldn't the company steal my code?

Share this post


Link to post
Share on other sites
Quote:
But I could be a "horrible goto-using programmer", but still manage to clean up and polish one of my messy codes.


In my experience, if ya do something just to get it to work, and not write cleanly... it'll be a snowball's chance in hell to go back and clean it up.

Also poorly written code builds up and makes it harder on yourself, since you have to go back and modify it later to make it do different things or fix bugs. Once you go back to fix a bug or add something to it, it'll be so hard to work on because of all of the hacks.

Trust me, if ya do it write it nicely the first time you save yourself a whole heck of a lot of trouble.

P.S dont use goto.

Share this post


Link to post
Share on other sites
It's not so bad. Say I have 2 goto's in my code. At worst, I can just rewrite the 2 offending functions.

Besides, I'm not saying that it's good programming practice to write goto's and have to fix them later. What I'm saying is, if the company sees your code and it looks clean, how can they know that you're not a sloppy programmer that just managed to clean up one project?

Share this post


Link to post
Share on other sites
They won't know that you're not a sloppy programmer who cleaned up one project, but it's all they've got to go on.

And I would send them a kitten. Everyone loves kittens.

For everyone's enjoyment...

Share this post


Link to post
Share on other sites
I always ask what they're looking for, exactly. If they want to see one method/class you can go through and polish it a bit. If they want to see a whole project just pick something you wrote recently.

Share this post


Link to post
Share on other sites
Quote:
Original post by Halma
Besides, I'm not saying that it's good programming practice to write goto's and have to fix them later. What I'm saying is, if the company sees your code and it looks clean, how can they know that you're not a sloppy programmer that just managed to clean up one project?

Because they're likely to also give you a programming exam. They'll compare the submitted code to the exam code in terms of style, and they WILL notice discrepancies. Habits are a lot harder to hide than you may think.

Oh, and for everyone's sake, become a better programmer. This "hack it through" mentality is something you should adopt in worst-case scenarios, not as a matter of standard practice.

Share this post


Link to post
Share on other sites
Quote:
Original post by Halma
What I'm saying is, if the company sees your code and it looks clean, how can they know that you're not a sloppy programmer that just managed to clean up one project?

Because everyone has there own opinions on what constitutes "clean" code, and will go to varying degrees of effort to achieve it. A sloppy programmer who uses gotos copiously and tidies it up before sending it off is likely to still end up with code containing convoluted logic, just without the gotos. At the other end of the scale, a good programmer might overlook or forget about a goto added as a quick hack, but the rest of the code would probably show that it's not the usual practice.

Share this post


Link to post
Share on other sites
Thanks for the input, everyone.

BTW, I'm not that "bad" a programmer, and I don't write terribly sloppy code. I just don't have a lot of comments, and I use an occasional goto. (Occasional means maybe once every couple thousand lines of code.)

Share this post


Link to post
Share on other sites
Still too often. I don't think I've ever used goto in C++ in over 10 years, including 5 years as a professional programmer. I don't say it should never be used, but I haven't needed it in games, software 3D engines or client-server applications :)

Share this post


Link to post
Share on other sites
A goto is fine as long as it isn't used to loop upward, just downward, and only a small distance. I'd hire you. You'd be my go-to guy.

Commented code is okay, but some of the hardest code to read is the NeHe code in which many lines are commented like the following:

height=1; // Making Height Equal One

Don't rig your code to be phony, and don't lie on your resume. They'll eventually find out the truth about both.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement