8 ms·
Another tip which I give: Interviewers vary widely in how much they care about whether your syntax is accurate, whether you handle invalid inputs, and whether y
by bshlgrs 11y ago
Another tip which I give: Interviewers vary widely in how much they care about whether your syntax is accurate, whether you handle invalid inputs, and whether you write unit tests. It's really useful to ask the interviewer whether they want you to worry about those things.
If you handle invalid inputs for an interviewer who doesn't care about that, they're going to be a little annoyed by you going more slowly than needed. If you don't handle invalid inputs for an interviewer who does care, then they'll think you're careless.
- ajeet_dhaliwal 11y agoGood point, I've encountered this. Some candidates unfamiliar with the process may not even realize they want you to ask that, I didn't know when I started out and used to think a good interviewer would specify what they want, that may not be true, although it would be a nice thing to remind a candidate they can ask for clarifications not just about the question but about testing and such. I know some interviewers may be interested in helping but it's important to note assholes exist, especially at larger companies. There can be head games and assumptions made where they needn't have been. Even when I've been hired it can feel like if I'd done it again I may not have been. Try your best but don't be too upset if it goes badly either. Similar questions often come up too, it's actually amazing how many questions there are about linked list and trees.
- bshlgrs 11y agoI also think that it's not obvious that the interviewer is doing the wrong thing here. The claim "good programmers should always think to guard against invalid input" isn't ridiculous on the face of it: maybe checking for valid input is a sign that they're careful and methodical, and of course you want to hire careful and methodical people! Or the other way around: I can imagine someone thinking "this person spent ages on checking for invalid input; I bet their code is always bloated and ugly". The problem is that programmers do this one way or the other based on personal preference, not because of actual differences in ability. Once you know that, it makes less sense to care one way or the other.
- jerf 11y agoIf you think my code's checking carefully for the validity of the input makes it bloated and ugly, you just failed my interview.
- greenleafjacob 11y agoThere's a correct place for every class of input validation. The point is that you don't want multiple levels of input validation for the same thing. Most of what passes for "defensive coding" is superfluous. For example, if you are passing a pointer into a function, you don't need to reflexively null check. However, null checks are important.
- alistairSH 11y agoIs there any reason an interviewer should care about syntax, etc? When I interview, I ask for psuedocode - I don't really care what language the interviewee uses, I do care that they can get their point across.
- jkarneges 11y agoThis happened to a friend. He confirmed that pseudocode would be acceptable, but then as he was writing it out the interviewer got on him about not terminating lines with semicolons (I suppose the pseudocode looked C-ish). So yeah I'd say make this clear.
- alistairSH 11y agoAck. I'm not sure how I'd react to that. I interviewed quite a bit last year (on the hiring side). I was really surprised by the variation in pseudocode written by the candidates. Most wrote something JavaScript-like, a few stuck to mostly proper Java or C. But then one dumped a giant web of crazy on the board (but still made his point) and one wrote something that looked suspiciously like COBOL - still not sure if he was trolling me.
- toomuchtodo 11y ago> Ack. I'm not sure how I'd react to that. Thank them for their time, leave, move on to next company.
- rhodysurf 11y agoI always write a weird mashup between python and C for some reason haha
- troels 11y ago"and one wrote something that looked suspiciously like COBOL - still not sure if he was trolling me." That's brilliant. Now I have to learn myself some COBOL just for that.
- debacle 11y agoIf I'm at a whiteboard and the interviewer cares that my syntax is accurate I'm probably wasting my time.
- joe_the_user 11y agoAnd the most humorous interviewers are those that stare at you and slowly answer "uh, mmm, whatever seems fair..." when you ask about these reasonable questions.
- jianshen 11y agoWhen I interview, I usually ask pseudocode first, then write it out in actual code. Think of it like writing a short essay. Outline first, then actually write the essay with proper grammar to the best of your ability. There will be typos and grammatical mistakes which I don't really care about but I do want to see your style and how you use the language to express what you want it to do.
- dkopi 11y agoYou can always preempt the whiteboard issue by bringing a laptop along. "Hey, I'm a lot more comfortable writing code on a keyboard and with an IDE. Lets program this together in a text editor instead of a whiteboard".
- steven777400 11y agoAs a candidate, I feel that it is fair to stand up for this as well. If the interviewer wants psuedocode, I'm happy to whiteboard it. But I've been whiteboarding before and had the interviewer say, "that code wouldn't compile, you're missing a bracket." So I said, "If you want code that compiles, bring in a laptop and I'd be happy to put it in to Visual Studio [it was a .NET position] and have it be syntactically correct; but if I'm whiteboarding, it's going to be psuedocode."
- sharpy 11y agoSome places I interviewed did mostly whiteboarding, but had a problem that required producing working code. One place had a standard desktop setup aside for me - with the most popular IDEs pre-installed. Another had me bring my laptop.
- jdhawk 11y ago"This organization uses whiteboards as their Code Editor?" - did not get the job.
- yomly 11y agoWhat was their response to this? I think it's perfectly valid to state this, and may even throw the balance of the interviewer/interviewee dynamics but I can also see other people seeing this as obtuse. But pointing out a missing bracket (in a nonconstructive manner) on a whiteboard is pretty obtuse too...
- darrenkopp 11y agoGreat point. I tend to be the person that realizes that interviews are stressful and I'm not gonna hold it against you if you miss sanitizing your input or similar issues, but I will call you out on it with a question like "well, what if you get X" and at least verify that you know that's an issue and let you then add the code in to accommodate for that.