4 ms·
It’s not nit-picky because the behavior of the two is completely different when ‘a’ isn’t present. If the assignment is dealing with dirty/partial data or impl
by kortilla 3y ago
It’s not nit-picky because the behavior of the two is completely different when ‘a’ isn’t present.
If the assignment is dealing with dirty/partial data or implementing APIs with optional fields, [] can be a complete deal breaker.
- jameshart 3y agoDeal-breaker? Is there evidence that programmers who use [] simply cannot ever learn to use .get()? Once they have picked up the incorrect approach, their brains are simply broken and they can never learn that a different solution exists that is better used in certain situations? It would obviously be risky to hire someone who uses [] if that's the case. If not, though, it seems like it doesn't provide much of a clue as to the person's ability to perform in a technical role.
- kortilla 3y ago> Deal-breaker? It’s a take-home test. I’m saying if the particular test called for dealing with a particular type of input and you didn’t do it, you failed. It’s that simple. If it didn’t, then it’s a pointless nitpick and shouldn’t ever be brought up as interview feedback.
- CalRobert 3y agoFortunately I was in a situation where I'm not too bothered about not getting the job but admittedly it would have been nice to have this chat with them. I am _very_ familiar with the advantages and disadvantages of both approaches and would, of course, adapt to house style, but where I am now we set up a nice pipeline in Dagster with a whole lot of boxes for assets, and at the risk of being non-technical I want the box with the bug to be the one that turns red. If I use x[] I get that. If I use x.get the red box could be three modules downstream because of a NoneType Exception.
- Kon-Peki 3y agoLearn! You aren't hiring people to learn. They must know everything they will ever need on day 1. (Forget what it says about your company - you only do things that people at other companies have been doing for years...) I once got rejected because my solution to an interview question didn't use recursion. I had spent the previous 5 years doing embedded work on hardware where stack overflow was a real possibility - we had a real aversion to recursion if we could avoid it.
- FrustratedMonky 3y agoIt is completely nit-picky, as others have said, both methods have pluses/minuses, so how does the interviewer know the internal preference of the hiring company? Unless the question was specifically "how would you do this lookup if you have Dirty data". Then maybe missing using a default value is something. But even then, maybe you hit an invalid value, you should fail, or if you are providing defaults then there should be some follow up on, what is a good default, how will defaults be reported out, etc....