views:

1128

answers:

10

As a second interview I get people to sit down and write code...I try to make the problem really technology independent.

My programming problems that I have don't really exercise peoples OO abilities. I tend to try and keep the coding problem solvable within 2 hours ish. So, I've struggled to find a problem small enough and involved enough that it exposes peoples OO design skills.

Any suggestions?

A: 

Lots of good questions and answers about this already.

Try this question.

Adam Liss
do you have a link to a question that has good OO type problems?
Keith Nicholas
huh? :) that linked question is similar, but not really targeted at small OO coding problems that an experience designer should have fun with
Keith Nicholas
A: 

These aren't specifically OO Questions, but check out the other questions tagged interview-questions

Edit: What about implementing some design patterns? I don't have the best knowledge in the area but it seems as if you would be getting two questions for the price of one. You can test for both OO and Design pattens in the one question.

mdec
yeah....I had a look at those... similar to what I do at the moment... I'm really wanting something interesting from an OO perspective. Usually I like games for OO type stuff, but its hard to find a game small enough and still involved enough
Keith Nicholas
I kind of want a problem they will potentially throw a few design patterns at (or better yet, take slices of design patterns thats most appropriate). But its completely up to them how / what they design
Keith Nicholas
A: 

I've got a super simple set. The idea is mainly to use them to filter out people who really don't know their stuff rather than filtering in the rock stars.

These are all 5 minute white-board type questions, so they are really not that hard. But the act of writing up code, and talking through it reveals a lot about a candidate - and is brilliant for exposing those that can otherwise BS through the talk.

  • Write a method that takes a radius of a circle as an argument, and returns the area of the circle (You would be amazed how many people struggle on this one!)
  • Write a program that accepts a series of numbers as arguments from the command line. Add them up, and print the sum
  • Write a class that acts as a keyed counter (basically a map that keeps track of how many times each key is "counted")
madlep
a) Not everyone would remember the math for the conversion off the top of their head - doesn't mean they arn't good programmers. b) Again doesn't show that they are good at OOP, just that they have done a lot of command line apps. C) More constructive than the others in terms of a good question.
vdhant
Not really OOP related
Guido
+2  A: 

ideally, you want to present a problem that appears difficult, but has a simple, elegant, obvious solution if you think in OO terms

perhaps:

  • we need to control access to a customer web site
  • each customer may have one or more people to access the site
  • different people from different customers may be able to view different parts of the site
  • the same person may work for more than one customer
  • customers want to manage permissions based on the person, department, team, or project

design a solution for this using object-oriented techniques


one OO solution is to have a Person, a Customer, an Account, and AccountPermissions, where the Account specifies a Person and a Customer and an optional Parent Account. the use of a recursive Account object collapses the otherwise cumbersome person/team/department/project structure a direct ERD solution might yield

Steven A. Lowe
+1  A: 

I have used the FizzBuzz Programming Test. And shockingly can corroborate the claims made by the article. As a second follow up I have asked candidates to compute the angle(s) between the hands on an analog clock. We set up a laptop with VS 2008 installed and the stub in place. all they have to do is fill in the implementation.

I am always stunned at how poorly candidates do on these two questions. I really am.

MikeJ
yeah, I use a couple of these type questions in the initial interview. It is quite surprising at times!!! Once they get to the interview I'm talking about here, generally they should at least be able to do basic coding
Keith Nicholas
+3  A: 

This is a problem that I use with some trainings, looks simple but is tricky OOP-wise:

Create model classes that will properly represent the following constructs:

  1. Define a Shape object, where the object is any two dimensional figure, and has the following characteristics: a name, a perimeter, and a surface area.
  2. Define a Circle, retaining and accurately outputting the values of the aforementioned characteristics of a Shape.
  3. Define a Triangle. This time, the name of the triangle should take into account if it is equilateral (all 3 sides are the same length), isoceles (only 2 sides are the same length), or scalene (no 2 sides are the same).

You can go on and on with quadrelaterals (which include squares, rectangles, rhombi, etc) and other polygons.

The way that they would solve the above problems would reveal the people who understand OOP apart from those who don't.

Jon Limjap
A: 

How about some sort of simple GUI. It's got inheritance, overriding, possibly events. If you mean for them to actually implement as part of the test then you could hand them a blank windows-form with an OnPaint() and tell them to get to it.

Yes Fish...
A: 

You could do worse than ask them to design a MapReduce library with a single-process implementation. Will the interface still work for a distributed implementation? What's the exception-handling policy? Should there be special support for chaining MapReduce jobs in a pipeline? What's the interface to the inputs and outputs? How are inputs chunked up? Can different inputs in one job go to different mappers? What defaults are reasonable?

A good solution in Python takes about a page of code.

Darius Bacon
+1  A: 

Hi,

Designing Social Security Application is something which I ask a lot of people during interviews.

The nice thing about this is everyone is aware of how it works and what things to keep track of. They also have to justify their design and this really helps me get inside their head :) (As there is lots of flexibility here)

Kind regards,

SharePoint Newbie
A: 

Whether or not people do some coding in the interview, I make it a point to ask this: Tell me about a problem you solved recently using object oriented programming. You'd be surprised how often people cannot answer that simple question. A lot of times I get a blank stare, or they say something like "what do you mean? I program in .NET, which is all object oriented."

Daniel Auger
yeah, I usually cover this kind of stuff in the first interview....and yes, it can be REALLY surprising
Keith Nicholas