4 ms·
Yes you can code up sum types in the object system of Java or C#. But are you allowed to do that? The problem write-up makes it sound like you're supposed to b
by throwaway729 10y ago
Yes you can code up sum types in the object system of Java or C#.
But are you allowed to do that? The problem write-up makes it sound like you're supposed to be ingesting the interviewer's input. So, how did the interviewer code up sum types? With tons of nasty casting out of List<Object>, or with a slightly less terrible object hierarchy mimicking sum types?
That's what makes the question terrible. It implies you're supposed to be coding against an interface, but in the allowed language (Java) it's totally non-obvious what the interface is.
I'll submit this criteria for coding question: if a big chunk of your candidates can't write down the friggen type of the program you want them to implement -- and if two reasonable people could write down extremely different types for the same question -- then your question is bad and you should throw it out.
- alkonaut 10y agoAgree 100%. Title of blog post could be "How do I keep failing to convey the basic constraints and requirements of a programming interview question?"