5 ms·
CSV is really fucking hard to parse. There's tons of edge cases. "I'd just use a well-known, well-tested library" is a very valid answer. One of my go-to quest
by thomascgalvin 9y ago
CSV is really fucking hard to parse. There's tons of edge cases. "I'd just use a well-known, well-tested library" is a very valid answer.
One of my go-to questions is "sort this array", and if the candidate types `Arrays.sort(input)` they get bonus points, because it shows they have useful knowledge of the language they'll be writing in.
- always_good 9y agoHere's how their scenario would actually play out: > I took my sunglasses off, looked him dead in the eye, > and said "Why? Why write your own method in > a vanilla language? Give me a good reason." Interviewer: "To see how you might approach it." It's a synthetic interview question. Why does it suddenly need to be a production-ready CSV parser? We don't have enough information to say whether these are bad interview questions, and it's really not the point. Maybe the interviewer just wanted to see if you'd use good fd hygiene (`with open('file.txt') as f:`) and that you can stub out some toy parser code and speak of it intelligently. And that you wouldn't throw a fit when asked to write some code that a library like `npm install fizzbuzz` can already solve.
- ascorbic 9y agoThat's a bit unfair. I agree that Array.sort is the best answer, but array sorting is such a classic interview puzzle that most candidates will expect that that's what you want. So instead of the bonus answer, they'll slog away trying to remember the algorithms that they learnt at uni years ago (or codecademy last month).