3 ms·
The problem with that is you might feel pressured to talk about Prius extends Car extends Vehicle etc. even if you wouldn't do that in real code because it seem
by quietbritishjim 4y ago
The problem with that is you might feel pressured to talk about Prius extends Car extends Vehicle etc. even if you wouldn't do that in real code because it seems the question is meant to probe the concept of inheritence so it's natural to answer that way.
It takes a brave interview candidate to say "the best solution depends on the exact nature of the problem - and your problem doesn't make any sense so there's no valid solution".
- BoorishBears 4y agoI feel like you picked up on the wrong problem in their example... > Prius extends Car extends vehicle extends motor extends The problem isn't that it's too in-depth, or too overbuilt, that answer is as close to objectively wrong as you get on a pretty open ended question and I'd imagine only an extremely junior developer would come up with that. For example, you could maybe argue that a model of car extends a specific car. I'd expect an experienced developer to favor composition over inheritance at that stage, but that's open to debate. But if a Vehicle extends a motor, does a motor extend a piston? Does a wheel extend a lug nut? At that point you're moving away from "arguably correct" to just plain failing to answer the question. It shows they don't know the difference between composition and inheritance. > It takes a brave interview candidate to say "the best solution depends on the exact nature of the problem - and your problem doesn't make any sense so there's no valid solution". You're free to ask questions, we're supposed to be trying to collaborate. I don't think it's "brave" to instead say "your problem doesn't make sense". Shows more hubris than anything. How is it any different than a systems design question?
- bdg 4y ago> It takes a brave interview candidate to say "the best solution depends on the exact nature of the problem - and your problem doesn't make any sense so there's no valid solution". I got that a few times and it's a good sign I have a senior candidate. The real-world use case is simple when you imagine that I want to get a JSON payload describing different car configurations, possibly for a "car configurator" on a sales website, or perhaps for a videogame where there are different cars with different attributes at random. Once I go from "make a car" to "give me some json" everyone started to see it's as a less fictitious problem.