Join 3,572 readers in helping fund MetaFilter (Hide)


Elevator question
January 30, 2013 9:47 AM   Subscribe

When an interviewer asks an interviewee for a programming job to design an object-orientated elevator control system, what are they looking for in a good answer?
posted by Artw to Computers & Internet (8 answers total) 7 users marked this as a favorite
 
They are probably looking at how you'd decompose the system into objects and link those together. I assume you've got floors, cars, requests (with subclasses pickup / dropoff), a dispatcher, maybe a scheduler, that sort of thing.
posted by rocketpup at 9:51 AM on January 30, 2013 [1 favorite]


What rocketpup said, a reasonable system so that you could do things like elevator.moveTo(floor); they may also want (and I would ask after you got something decent for the first part) some algorithms for how your elevator might actually move. I.e., what happens when the elevator is on the third floor and gets requests to pick people up on both the first and fifth floor. Where does the elevator park itself when it's not getting any requests. If the elevators on the 90th floor, and coming down, and gets requests to stop at all 90 floors on the way down, how many will it honor?

This becomes a problem solving question instead of a design question, but I think it's useful and a logical extension of the OO question.
posted by tylerkaraszewski at 10:07 AM on January 30, 2013 [1 favorite]


When I ask those sorts of questions in interviews, I'm looking much less for any specific answer, and more for your thought process in how you get to the answer. I think that's true of a lot of the questions asked in programming interviews.

I would be looking for your approach and process for the following (roughly): That said, there certainly are answers to the question that would ring alarm bells for me, regardless of the process used to get there. But as long as you end up with a somewhat reasonable OO system, I really want to see how you think.
posted by duien at 10:09 AM on January 30, 2013 [3 favorites]


Bonus points if the interviewee mentions relevant OO design patterns such as Factory for generating instances of TestElevator rather than ActualElevator or State for, I dunno, deciding what requests an Elevator stops for when going up or down. These examples may not be great because I'm not really thinking through the exercise, but to answer in a phrase, Design Patterns or darned good reasons not to use them.
posted by Monsieur Caution at 10:25 AM on January 30, 2013


If I am thinking about that problem and deconstructing it in to reasonable objects (and their associated methods/functions) I probably throw in (at least verbal) consideration of:
-Elevator operation optimization; functions where finding best path are built in and natural (coding to solve a real problem, not just to develop a passable routine)
-Optimization where the number of elevators exceed 1 (an optimization perspective that allows elevators to split demand efficiently and dynamically)

These would be examples of building for the future and building for modularity. Other than showing an understanding of OOP, I think that these would be some of the key things you would want to sniff out.
posted by milqman at 11:33 AM on January 30, 2013


I don't ask the elevator question, but I've asked vaguely similar OO design questions. The first thing I'm looking for is someone who takes a step back and looks to discuss the problem in more detail. I'll ask the question in the most generalized terms (i.e. "an object-orientated elevator control system"). If a candidate immediately goes to the whiteboard and starts churning out classes, that's not a great sign. I'd prefer someone who wants to know more about the requirements. Are we controlling one elevator per building or several? Are there express elevators? Keypads in the lobby where passengers enter their desired floor and are directed to a particular elevator? Requirements for morning and evening rush hour scheduled behaviors? Integration with fire alarms, security systems, and other building components? Is it a space elevator? A temporary hoist at a construction site? Does the client even actually want an elevator control system or does he really need a pneumatic tube control system but asked for the wrong thing? Asking questions to understand and clarify the requirements is a key part of the design process.
posted by zachlipton at 12:07 PM on January 30, 2013


Everyone has good points, but if you're thinking about a more entry level interview, sometimes they're happy just to see someone who can separate nouns and verb phrases into the right spots. You'd be amazed how many recent graduates don't instinctively do this.
posted by anaelith at 11:06 PM on January 30, 2013


FWIW, this is a very common question. If you Google [elevator design question], the top hit is over at StackOverflow and there are some good answers there too.

BTW, the varying answers in here point to a very important point: some interviewers will be more interested in the broad-level design, and others will care more about the scheduling algorithm. Make sure you frequently sync with the interviewer to make sure you're going where s/he wants.
posted by Talisman at 11:57 PM on January 30, 2013 [1 favorite]


« Older I'm looking for a professional...   |  Recently I've been thinking of... Newer »
This thread is closed to new comments.