views:

421

answers:

4

There are several topics about what questions will be raised in an interview for a programming job, but none actually talk about a small problem that some companies want: an example program.

My question is based on my last job application, where I've been asked to create a simple program and send it to them.

Well, this raises several questions:

  • what kind of program should I write?
  • what should I implement?
  • what should I use as a show-off for technical stuff?

and mostly importantly (been several users of SO that person that review the code) what is the company expecting?

My current idea is to create a simple Blog using an XML file to store the data, and if required build a simple one ASP.NET page with add/edit/delete functions, and create a window forms as well a command line application that would do the same.

things that I should NOT avoid:

  • comment all the code
  • use regions to divide code
  • create class object to use with the "blog"

and should I:

  • use Interfaces?
  • use Virtual and override some method (myBlog.ShowPost() for example)?
  • apply any design pattern?
  • use a Helper / Utilities Class?
  • use DAL and BLL?

how about "shipping" should I...

  • use MSI (to prove that I can create nice installers)
  • just send the code as a Visual Studio Project

Any idea of a simple program, and exactly what should be in the code is greatly appreciated :)

+2  A: 

ask the customer what they want, don't guess

you write an xml-blog program, they say "that's nice but we do desktop development here"

you write an optimized non-relational parallel database, they say "that's nice but we make financial web apps here"

Steven A. Lowe
normally I do apply for .NET no matter what, and that is why I refer "if asked build a winform and command line" :)
balexandre
Or who knows they may even be trying to rip you off.
SoloBold
+2  A: 

Use the opportunity to show them you know how to treat a client. Start a conversation on what is important, how do they want it delivered, what is the timeline, would they want a documentation and so on.

If they don't want to give you any particular problem to solve, try to write a program related to the domain of their main product. Or at least stick with some of the technologies they use.

Be sure that whatever you deliver to them is complete enough and contains source code and deployment package. Make sure you have good enough documentation, so that a technical person is able to build your program successfully with at most two three simple steps. Make the deployment package simple enough, so that a non-technical person could quickly run your program. It doesn't have to be MSI, a batch file that copies all the files would suffice, as long as it's a single command.

Make sure your code is well organized and commented. Avoid writing obscure code hacks and unnecesasry optimizations. Find a set of good coding guidelines (SO has several threads on that topic) and stick with them.

Avoind the Commando Pattern. :-) Use design patterns you feel comfortable with. Use interfaces, inheritance, abstractions and the proper architecture layers where appropriate.

On other words, write the code so that a programmer with a lower skill than your would be able to undestand and maintain it.

Using external code in your program would be ok, as long as you make sure they are aware of that. Be clear where any code came from and what license it was published under.

As a side note, add a license to your code that prohibits republishing or reuse for commercial purposes.

All that above sounds a bit too complicated, but that's what professional developers do - they don't just write code, they deliver a product.

Franci Penov
A: 

Simple programs that would be my suggestion:

1) Look at the example given in Refactoring about a movie rental example involving customers, movies and rentals that one could specify out to some length to show what they can do.

2) FizzBuzz is another simple program idea that is talked about in various places.

3) Some simple string functions like reversing a string or for a given integer return how many one bits are on.

Don't forget that you should document things like complexity of your algorithms(time and space), which assumptions you make in your code, what tests you did to verify your code, as well as possibly a general README that may help any developer that inherits the code.

JB King
A: 

To me it sounds fishy. They want you to write a whole example application for them, for free, to see if they want to hire you? Is this a permanent position or a consulting gig?

I wouldn't do it. It would seem to me that if you are anything but desperate that your time would be better spent applying to other companies that have more fitting interviews.

SoloBold
I had the same thought. I have been headhunted for positions, and I wish I had told prospective employers to send me a weeks salary to see if I like the compensation.
Guge