Recent tech interview misstep

I’ll clarify a couple things – I’m not sure this was a misstep entirely, but felt awkward in the moment. And… this wasn’t a ‘job’ interview, but a short term contract I was interviewing for. Freelance/contract ‘interviews’ typically are looser than a full on ‘job’ (for a variety of reasons I may get in to later), but it happened that they’re basically looking for another pair of hands for the short term, and there’s already a pretty technical group of folks I’ll be working with, and they wanted some ‘real life’ interaction.

I was given a link to coderpad, and was also doing a voice call with one of the other chaps. The core task was to take a given array of data, pass it to a function and do some calculations. Outside of some date sorting (which I’d just noted up front I wasn’t going to bother with because there were no helper libraries available to deal with date complexities during the session), I had the basics working in a short time.

There were some ‘further challenges’ listed below the main exercise, mostly revolving around how to handle error checking. This was the ‘misstep’, potentially. Given that we were dealing with nested arrays, in PHP, I made some basic helper functions to check for the existence of particular keys, and would throw an error if the key didn’t exist.

function checkValidKeys($array) 
throw new \Exception("blah");

The chap on the phone asked if I knew about ‘coalescing’, and my brain jumped to SQL “COALESCE”, which didn’t quite jive. I stumbled for a moment, then he typed in the ?? operate in PHP…

$foo = $array['foo'] ?? null;

This is a new operator in PHP, since 7 (which, admittedly, isn’t that ‘new’ anymore), and I’d indicated that I’ve not used that before. Variety of reasons, some to do with “regular habits”, and some to do with the fact that some of the projects I’ve been triaging in the past year are still PHP 5.5 and 5.6. I’m often jumping between styles and environments, so adopting the newest features isn’t always an option.

However, I pushed back a bit more, based on the situation, and indicated I probably still wouldn’t use that technique in these situations. Why not? If ‘foo’ isn’t present in an array, for the situation presented, that’s probably a Bad Thing (TM), and represents an exceptional scenario to be dealt with. I countered that I’d more than likely use a specific object type (FinancialRequest might have fit for the sample in question), which would give me a better idea of property names available and expected, and the object itself could do some sanity checking as well.

This was the ‘misstep’, so to speak – pushing back on someone during an interview. I’ve not actually gone through this situation in a long time, and the last time I did it, I was not brought on board (I got in to a rather testy back and forth with someone about MySQL indexing interviewing with a team at Zappos years ago, which apparently didn’t end well – or maybe it did?)

I guess it went well enough, as I will be starting working with that team on a short term basis next week.

Leave a Reply

Your email address will not be published. Required fields are marked *