3 ms·
Do you seriously think anybody would confuse this snippet for production code?
by mark-r 9y ago
Do you seriously think anybody would confuse this snippet for production code?
- zaphar 9y agoYou've obviously never seen the kinds of production code that I have. This example is clearly distilled down but manifestations of the cause can be found in many different languages and I've encountered quite a few of them in my day. That said I wouldn't really consider this a good interview question.
- protomyth 9y agoCheck me on this one. What if this is some absurd way to do a series of process steps where the a == 1 checks if you can do step 1 and then executes step 1 with a being set to 1 on success and 0 on failure thus allowing the && to go to the a == 2 comparison which handles step 2. This continues with the rest of the line. Its just psycho enough to be plausible in a truly dysfunctional way.
- zaphar 9y agoI have encountered code written by people just psycho enough to think that's a clever way to handle just that scenario. They were not wrong it was indeed clever. It was also terrible.
- protomyth 9y agoThe sad part is I too can see someone who needs to do batch processes reading about short circuit evaluation and having this "amazing" idea for a framework that would look exactly like that if. Its moments like those that make me wake in a cold sweat.
- FLUX-YOU 9y agoIf they want me to assume this kind of code would never be in prod, then they can assume I know how to write code and we can dispense with the technical interview altogether.
- billconan 9y agoIMO, a good interview question should reflect daily work.
- mark-r 9y agoIf this were the only code they showed you, then you can consider that a fail on their part. Remember that an interview goes both ways.
- protomyth 9y agoWell, given some of the code I have seen, I would have a sneaking suspicion that clean code was not the hallmark of this company's source code. They are also probably asking these type of questions because they use some of these "cool techniques" in their code. I then start having a flashback to some code in 98 that I had to debug at 2AM to get the damn batch job out by 6AM that turned out to be some really "clever code"[1]. Yeah, I might checkout early and run for the parking lot. 1) said right there in the comment, but not why or how it was clever or what it really did