News for hackers. Stuff that matters.
Re:I've been a software engineer for 10 years and I can't do... by pklausler on Monday March 06, 2017 @12:45PM (#13804408)
If you hate the idea of coding questions as part of interviews, please consider the other side for a moment.

There are people out there (not you, obviously) who can talk their way into an interview for programming jobs that they simply can't perform. We're talking about no skills whatsoever, apart from the ability to sling buzzwords around enough to impress a recruiter. God only knows how they get their degrees, but they have them.

Simple, straightforward programming questions that aren't already on the Web are like an immune system response to these non-programmers who interview for programming jobs. I'm truly sorry when a real programmer feels insulted when I ask them something like "given the starting and ending times of two calendar appointments, write an expression that's true if they conflict", because it's not their fault that there are people out there who will struggle for 20 minutes thinking about how to solve it before trying something like a doubly-nested loop over all the milliseconds in both intervals, testing for equality.

I am not making this up. It's a real problem. if you can program a digital computer, you have nothing to fear from a good coding interview. And if you have a better way to reliably identify the non-programmers, I'd love to hear it.

Re:I've been a software engineer for 10 years and I can't do... by jcadam on Monday March 06, 2017 @01:05PM (#13804607)
I myself have sat in an interview with my mouth agape as I watched a "senior" engineer try to figure out how to find the largest element in a one-dimensional array.

So, anymore I don't have much of a problem with simple coding questions to filter out total non-programmers (fizzbuzz, your calendar problem, etc.).

But the whole stand on one foot and implement a red-black tree in bash script on the whiteboard while I peck at my smartphone and sigh every time you pause to think has got to freaking stop.

Re:I've been a software engineer for 10 years and I can't do... by dpark on Monday March 06, 2017 @01:32PM (#13804860)
> while I peck at my smartphone and sigh every time you pause

This is a much bigger deal to me than difficult algorithm questions. Shitty interviewers give shitty interviews, regardless of what kinds of questions they ask.

The worst interview I ever had was like this. The guy showed up late, told me he forgot he even had an interview, gave me a strange question with little detail, and told me to start coding. Then ignored me for an hour while he typed on his laptop. Even when I directly asked for feedback to make sure I was solving the problem he asked and not a misunderstanding, he gave me basically no feedback. I've had interviews that I bombed before, but this was the first and only time that I felt like I bombed an interview and it was utterly not my fault. It was also the only time I've had a bad interview that actually ruined the rest of the day for me because it threw me off so much.

Re:I've been a software engineer for 10 years and I can't do... by tonyedgecombe on Monday March 06, 2017 @02:19PM (#13805228)
I think I would just walk out at that, at the end of the day this is someone you are going to have to work with or for.
Re:I've been a software engineer for 10 years and I can't do... by dpark on Monday March 06, 2017 @03:24PM (#13805763)
I wish I had. If something like that ever happens again, I will.
Re:I've been a software engineer for 10 years and I can't do... by pklausler on Monday March 06, 2017 @01:52PM (#13805038)
> implement a red-black tree in bash

The only good answer to that is "I can't imagine why I'd ever need to do that, and if I had to anyway, I'd use a 3-2 tree instead because it's almost as good and nobody ever gets red-black trees right the first time."

Re:I've been a software engineer for 10 years and I can't do... by ep103 on Monday March 06, 2017 @01:30PM (#13804838)
I had two people this week, 10+ years "experience", fail at writing a function removing duplicate values from an array.
Re:I've been a software engineer for 10 years and I can't do... by badthingfactory on Monday March 06, 2017 @01:45PM (#13804977)
I have interviewed two "senior web developers" with "10+ years" of experience that were unable to tell me the difference between a 404 and 500 http response code. Of course, they had perfectly memorized answers about JavaScript closures.
Re:I've been a software engineer for 10 years and I can't do... by lj3 on Monday March 06, 2017 @02:02PM (#13805107)
who memorizes http response codes?
Re:I've been a software engineer for 10 years and I can't do... by dragonwriter on Monday March 06, 2017 @06:13PM (#13806971)
Presumably, programmers who are working with the web should have a passing familiarity with the most common categories; this isn't memorizing all of them, but being able to recognize the significance of 2xx vs 3xx vs 4xx vs 5xx codes isn't an unreasonable expectation.
Re:I've been a software engineer for 10 years and I can't do... by ep103 on Monday March 06, 2017 @02:27PM (#13805297)
Who can't tell the difference between a 404 and a 500?
Re:I've been a software engineer for 10 years and I can't do... by falsedan on Monday March 06, 2017 @04:44PM (#13806321)
Somebody who rarely instructs a user agent to make requests to a server.
Re:I've been a software engineer for 10 years and I can't do... by badthingfactory on Monday March 06, 2017 @10:59PM (#13808163)
This isn't entirely accurate. I told my RN Fiance this story and she said "oh 404, that's like... page not found or something isn't it?" She has zero programming experience.
Re:I've been a software engineer for 10 years and I can't do... by RandomOpinion on Monday March 06, 2017 @06:00PM (#13806878)
So, basically, somebody who never uses a web browser? 404 and 500 should be familiar just from browsing the web for more than a few weeks.
Re:I've been a software engineer for 10 years and I can't do... by dragonwriter on Monday March 06, 2017 @06:10PM (#13806950)
Modern browsers seem to do quite a bit to insulate users from error status codes in their default configurations.
Re:I've been a software engineer for 10 years and I can't do... by 6nf on Monday March 06, 2017 @05:59PM (#13806864)
The people in question do in fact use internet browsers on a daily basis.
Re:I've been a software engineer for 10 years and I can't do... by falsedan on Monday March 06, 2017 @07:50PM (#13807470)
That's good to hear.
Re:I've been a software engineer for 10 years and I can't do... by jcadam on Monday March 06, 2017 @02:47PM (#13805468)
Programmers who want their REST API to return correct http response codes. I have a good many of them memorized by now. :(

...someday I'll find an excuse to return a 418.

Re:I've been a software engineer for 10 years and I can't do... by lj3 on Monday March 06, 2017 @08:46PM (#13807698)
Bah! Just always return 200 and if there's an error, make your users look for an error property in the json return value that contains a thoroughly unhelpful error message, like "I'm a teapot." ;)
Re:I've been a software engineer for 10 years and I can't do... by watwut on Monday March 06, 2017 @02:21PM (#13805252)
Web developers spend most of their time in javascript - coding fronted where closures and functional programming matters a lot. Maintennable modern fronted is done that way.

They spend very little time staring at http error codes. Like, none.

Re:I've been a software engineer for 10 years and I can't do... by wink on Monday March 06, 2017 @02:39PM (#13805404)
Web development includes server-side, and that API the fancy JS code is interfacing with.
Re:I've been a software engineer for 10 years and I can't do... by watwut on Tuesday March 07, 2017 @02:03AM (#13808776)
Node.js is javascript too :). Even there, error codes are something you maybe handle once when the project is setup and the rest of the time you deal with everything else.
Re:I've been a software engineer for 10 years and I can't do... by sigsergv on Monday March 06, 2017 @08:53PM (#13807729)
Are you sure it was exact question about largest element in a one-dimensional array and not some highly obfuscated question about bees, trains and traveller bags?
Re:I've been a software engineer for 10 years and I can't do... by zzzcpan on Monday March 06, 2017 @02:36PM (#13805379)
"There are people out there (not you, obviously) who can talk their way into an interview for programming jobs that they simply can't perform. We're talking about no skills whatsoever, apart from the ability to sling buzzwords around enough to impress a recruiter. God only knows how they get their degrees, but they have them."

"I am not making this up. It's a real problem. "

No, it's a survival bias. You have no way of knowing how they perform, unless you hire them, but you don't hire them, because they can't pass your interview process.

There are many reason why someone capable and experienced would "fail" an interview like that. But ultimately it just doesn't test for skills related to software development.

Re:I've been a software engineer for 10 years and I can't do... by pklausler on Monday March 06, 2017 @05:00PM (#13806431)
If a candidate can't construct a simple Boolean predicate to characterize a well-defined condition in an interview situation, do you really think that they're going to be able to do much more complicated work later if we hire them?

Be serious.

Re:I've been a software engineer for 10 years and I can't do... by synicalx on Monday March 06, 2017 @05:28PM (#13806653)
This is HN, we can't be serious unless everyone gets a medal
Re:I've been a software engineer for 10 years and I can't do... by nissimk on Monday March 06, 2017 @02:44PM (#13805442)
It's not just survivorship bias, it's also confirmation bias. These folks fail to acknowledge the adverse selections made by their process. What about the people on your team that didn't work out? What about the net-negative producers? I don't believe you that your whiteboard heavy process eliminates all of those people. I've seen the counter-examples.
Re:I've been a software engineer for 10 years and I can't do... by framebit on Monday March 06, 2017 @12:52PM (#13804475)
YES. This is why interviewers ask experienced devs to do FizzBuzz. It's not an insult, it's a safeguard.
Re:I've been a software engineer for 10 years and I can't do... by watwut on Monday March 06, 2017 @01:49PM (#13805014)
I consider myself an experienced developer and have experienced collegues who likely could not do FizzBuzz or solve simple algorithms like finding duplicates. The worst was when they had high charisma and could talk well in generalites and bluff - took long for management to figure them out.

Experience taught me not to be insulted about those questions. They guarantee all collegues will be able to pass them.

Re:I've been a software engineer for 10 years and I can't do... by mixmastamyk on Monday March 06, 2017 @01:57PM (#13805063)
Fizzbuz is not what we're talking about here. It is "balance a tree" with me looking over your shoulder (and $100k in a suitcase) type of problems.
Re:I've been a software engineer for 10 years and I can't do... by usrusr on Monday March 06, 2017 @02:07PM (#13805134)
So that if the candidate struggles at fizzbuzz (instead of showing off a well rehearsed set piece), they have an indication that what the candidate told before stems from actual ability and not from ruthless optimization for the local maximum of being good at interviews?
Re:I've been a software engineer for 10 years and I can't do... by nissimk on Monday March 06, 2017 @01:16PM (#13804697)
OK, but I got this question:

http://www.geeksforgeeks.org/given-n-appointments-find-confl...

It requires the simple comparison you mentioned, but is far more complex to come up with an efficient algorithm. Needless to say, I totally failed that one. Never heard of an interval tree until I looked it up after the interview. It took me just a moment to look it up with my awesome google skills and if I had to actually use that, I could copy paste that code in an instant :-) Even better, I could find a library and not even have to copy paste.

One time I was working on a language translator at my actual job. I was storing formulas for excel columns in a database and they had to be translated from their representation in the database to the excel formula language. It turns out that the columns had dependencies on one another and they had to be processed in dependency order. This required something called a topological sort. Again, something I had never heard of before I encountered this problem at work (I do have a CS degree). But I found the solution by a quick google search and employed a library that was already in use in my client's software that contained that algorithm.

That's the actual skill that's valuable: translating your requirements into a bunch of search terms that will quickly give you the name of the algorithm you need. (and obviously building the inputs / working with the outputs of that algorithm). Yeah, I guess if you already have all of those in your in your brain already you might save some time, but what about when you encounter a problem you don't know how to solve?

Re:I've been a software engineer for 10 years and I can't do... by btschaegg on Monday March 06, 2017 @02:21PM (#13805249)
Not sure if I'm overlooking something obvious, but given the possibility to reduce dates/times into simple integers (doable according to the example), you should be much faster sorting the data and using and intelligent comparing than allocating a tree with O(n•logn) nodes. Those heap allocation should slow you down drastically, at least for any problem size where linear work is still efficient enough.
Re:I've been a software engineer for 10 years and I can't do... by tzs on Monday March 06, 2017 @05:56PM (#13806855)
I do not understand the problem you linked to of finding "conflicting appointments". It does not usefully define what a "conflict" is, only saying that "An appointment is conflicting, if it conflicts with any of the previous appointments in array". It does not say what "conflict" means for appointments.

A natural assumption is that two appointments conflict if their times overlap.

The example instance of the problem gives this as input:

> Input: appointments[] = { {1, 5} {3, 7}, {2, 6}, {10, 15}, {5, 6}, {4, 100}}

The problem spoke of "appointments in array" and this is an array, so apparently {1, 5} {3, 7}, {2, 6}, {10, 15}, {5, 6}, {4, 100} are the appointments themselves. So we have 6 appointments.

So I'd guess that {1, 5} means an appointment that starts at time 1 and ends at time 5. That {4, 100} concerns me, though...if the numbers are times there is no obvious unit of time for which all of these appointments make sense.

They give this as the expected output for the above input:

  Output: Following are conflicting intervals
  [3,7] Conflicts with [1,5]
  [2,6] Conflicts with [1,5]
  [5,6] Conflicts with [3,7]
  [4,100] Conflicts with [1,5]
OK...all of those ARE conflicts under my guessed interpretation of the notation. But under that interpretation, {2, 6} should conflict with {3, 7}, and {4, 100} should conflict with everything else.

So that means my interpretation of the notation {x, y} on input meaning an appointment from time x through time y is not right.

Another idea is that {x, y} means person x and person y have an appointment together, and two appointments conflict if the same person is involved in both. Nope...that doesn't give the sample output either.

OK...maybe the sample output is wrong. So now I grabbed their code and compiled it on my Mac and ran it. It produced this output:

  Following are conflicting intervals
  [3,7] Conflicts with [-1960454340,32767]
         [2,6] Conflicts with [-1960454340,32767]
         [10,15] Conflicts with [-1960454340,32767]
         [5,6] Conflicts with [-1960454340,32767]
         [4,100] Conflicts with [-1960454340,32767]
WTF? OK...so I take it to a Linux box, and try it there, and it gives the output given at the site. Hmmm. I do see that I got a compiler warning on the Mac and not on Linux, about control reaching the end of a non-void function. The function newNode is missing a return! Putting "return temp;" at the end gets rid of the warning, and then the Mac produces the same output as Linux. (Raising the question of why gcc on my Linux box did not warn about the missing return...).

Anyway, I see that there is a function in there to determine if a pair of appointments overlap:

  // A utility function to check if given two intervals overlap
  bool doOVerlap(Interval i1, Interval i2)
  {
      if (i1.low < i2.high && i2.low < i1.high)
          return true;
      return false;
  }
OK...looking at that, it sure looks to me like it should say that {2, 6} and {3, 7} overlap. A quick test confirms that {2, 6} and {3, 7} in fact do overlap according to doOVerlap. So why isn't it figuring that out?

Putting a printout in doOVerlap to see how it is getting used:

  // A utility function to check if given two intervals overlap
  bool doOVerlap(Interval i1, Interval i2)
  {
    cout << "check " << i1.low << "," << i1.high
        << " against " << i2.low << "," << i2.high << "\n";
    if (i1.low < i2.high && i2.low < i1.high)
        return true;
    return false;
  }
changes the output to this:

  Following are conflicting intervals
  check 1,5 against 3,7
  [3,7] Conflicts with [1,5]
  check 1,5 against 2,6
  [2,6] Conflicts with [1,5]
  check 1,5 against 10,15
  check 3,7 against 10,15
  check 1,5 against 5,6
  check 3,7 against 5,6
  [5,6] Conflicts with [3,7]
  check 1,5 against 4,100
  [4,100] Conflicts with [1,5]
OK...so it is not finding that {2, 6} and {3, 7} overlap because it is never even checking them against each other.

I'll leave it to someone more curious than I to figure out what is wrong with their "solution".

Re:I've been a software engineer for 10 years and I can't do... by tzs on Monday March 06, 2017 @08:07PM (#13807548)
PS: here is a quick and dirty Perl program to do it. I did not bother matching the output format exactly, as I just wanted to get the algorithm right. This should be O(n log n) where n is the number of appointments, assuming that the built-in sort is O(n log n) and that the built-in hash implementation is O(n log n) or better.

    my @appt = ([1, 5], [3, 7], [2, 6], [10, 15], [5, 6], [4, 100]);

    my %active;
    my @endpoints;

    for (my $i = 0; $i < @appt; ++$i)
    {
        my($start, $end) = @{$appt[$i]};
        push @endpoints, [$start, 1, $i];
        push @endpoints, [$end, 0, $i];
    }
    @endpoints = sort {$a->[0]*2+$a->[1] <=> $b->[0]*2+$b->[1]} @endpoints;

    foreach (@endpoints)
    {
        my($time, $side, $which) = @$_;
        if ($side == 0) {
            delete $active{$which};
        } else {
            print "$which overlaps $_\n" foreach sort {$a <=> $b} keys %active;
            $active{$which} = 1;
        }
    }
Idea behind this: make list of all the appointment endpoints, tagged by whether they are a start or end time and which appointment they came from. Sort this by time, with end times coming ahead of start times if a given time occurs more than once. You can then scan this list, keeping track in a hash which appointments you have seen a start time for without yet seeing the corresponding end time.

When you see an end time, you can delete the appointment from the hash. When you see a start time, the appointment that supplied it overlaps with all the appointments currently in the hash.

Re:I've been a software engineer for 10 years and I can't do... by rnovak on Monday March 06, 2017 @01:19PM (#13804727)
What happens when you're asked to solve a problem that hasn't been solved before? By definition something you CANNOT google for

That's what I was looking for as a hiring manager.

Re:I've been a software engineer for 10 years and I can't do... by meheleventyone on Monday March 06, 2017 @01:34PM (#13804870)
Generally you end up doing a review of relevant literature and a few days/weeks/months of research and development. I'm not sure answering a question under pressure that has just been asked is that relevant to making ground in new areas of research.
Re:I've been a software engineer for 10 years and I can't do... by rnovak on Monday March 06, 2017 @01:46PM (#13804989)
The point is that solving problems, either by inventing new computer science, or more likely formulating a hybrid of known algorithms requires some semblance of problem solving.

A genuine interviewer (and I realize several/many may not be genuine) is solely trying to figure out if the candidate has these types of reasoning skills.

Let me phrase it this way: By asking a common CS question, you'll get people who simply memorize answers/algorithms. By asking something obscure that is rarely known, you can try to get a glimpse into someone's thought process, which is infinitely more valuable than rote memorization.

Re:I've been a software engineer for 10 years and I can't do... by meheleventyone on Monday March 06, 2017 @02:26PM (#13805287)
Right but there are lots of ways to test problem solving skills that don't involve asking people to both solve a surprise (and obscure) problem and come up with code at the same time whilst under stress. The latter three things are probably clouding your results in a way it's not really possible to account for. It seems like a lot of people setting interviews lack a bit of empathy.

The grandparent seems like the problem solving equivalent of yelling "think fast" whilst tossing a basketball at someone's face to test reflexes.

Re:I've been a software engineer for 10 years and I can't do... by rnovak on Monday March 06, 2017 @04:08PM (#13806052)
Okay, give us a generalized example? everyone who (appears) to care about being empathetic while at the same testing for these skills is continually asking for better options.

If you're hiring a point guard, isn't testing their reflexes by tossing them a basketball a reasonable approach?

Re:I've been a software engineer for 10 years and I can't do... by falsedan on Monday March 06, 2017 @04:59PM (#13806426)
Ask a simple, standard question that the candidate could reasonably answer in 10 or so minutes, confirm it works with them, and then change the parameters to invalidate their solution?

This is the closest I can get to actual project work in 45 minutes.

Re:I've been a software engineer for 10 years and I can't do... by rnovak on Monday March 06, 2017 @09:07PM (#13807773)
The second the interviewer changed the parameters people would start complaining that they were "Setup to fail." These threads commonly illuminate that interviewers simply cannot win, regardless of how genuine they are.
Re:I've been a software engineer for 10 years and I can't do... by falsedan on Tuesday March 07, 2017 @04:33AM (#13809267)
That's why I recommend confirming that the candidate's first solution was right. Use lots of positive feedback: ok, looks good, that's right, that's how I would do it; I see where you're going with this; etc. Then introduce the change, with a justification e.g. the team providing the input data changed their format/guarantees/technology, and we have to blah blah blah.
Re:I've been a software engineer for 10 years and I can't do... by falsedan on Monday March 06, 2017 @04:56PM (#13806398)
Why bother? You still fail to detect candidates who memorized the answer.

My standard coding question is a funny-looking prime sieve. If someone isn't familiar with one, we can work it through together and I'll have a much better idea of their learning potential & what they'll be like to work with than the intern straight out of their Algorithms final.

Re:I've been a software engineer for 10 years and I can't do... by rnovak on Monday March 06, 2017 @09:01PM (#13807751)
Personally, I don't bother. I went the route of requesting candidates go through a work sample project that I spent a considerable amount of time trying to standardize across all the languages relevant to the role. In the end though, management wasn't for me, and so I ended changing roles for something non-managerial
Re:I've been a software engineer for 10 years and I can't do... by mixmastamyk on Monday March 06, 2017 @01:39PM (#13804933)
Work sample tests are better in several ways to white board/puzzle tests. The latter is what the original article is objecting to, not coding demonstrations in general.
Re:I've been a software engineer for 10 years and I can't do... by pklausler on Monday March 06, 2017 @01:43PM (#13804959)
No. Non-programmers are great at getting other people to do their work for them. I think that's how they get their degrees. It's only when you force them to demonstrate a small bit of problem-solving and coding skill that you can expose them, and that has to be done in real time and off line.
Re:I've been a software engineer for 10 years and I can't do... by mixmastamyk on Monday March 06, 2017 @02:50PM (#13805486)
> to demonstrate a small bit of problem-solving

That's what the work sample test does. It doesn't have to be given off site.

Re:I've been a software engineer for 10 years and I can't do... by tempw on Monday March 06, 2017 @12:57PM (#13804521)
I am not the author, just to clarify that.

I think the point here is more about how experienced programmers track records are not enough to prove they can do the work sometimes.

Using whiteboard questions to prove ones competency can backfire as well in cases candidates are not really prepared but learned to game the system.

Re:I've been a software engineer for 10 years and I can't do... by lj3 on Monday March 06, 2017 @01:30PM (#13804839)
The real problem with whiteboard tests (and it's close cousin, the live coding test) is there is no correlation between being able to pass that test and being able to do the job. Companies that rely on it to determine programming ability are like the drunk looking for his keys under the street lamp because that's where the light is.
Re:I've been a software engineer for 10 years and I can't do... by pklausler on Monday March 06, 2017 @01:40PM (#13804947)
"no correlation"? Nonsense. If you can't program a computer, I'll find that out. And if you can't program a computer, you wouldn't be able to do the job.

The point of my coding interview isn't to give a positive result if the candidate can program a computer. It's a test that's looking for non-programmers.

There might be "false positives", but if I avoid well-known memorizable questions, there won't be "false negatives".

Re:I've been a software engineer for 10 years and I can't do... by cema on Monday March 06, 2017 @03:05PM (#13805612)
There will be false negatives too, but most likely not related to the skills but something else, like mental health or work ethic.
Re:I've been a software engineer for 10 years and I can't do... by pcglue on Monday March 06, 2017 @05:34PM (#13806704)
>struggle for 20 minutes thinking about how to solve it before trying something like a doubly-nested loop over all the milliseconds in both intervals, testing for equality.

Tell me you're kidding... that this is just a contrived example. please.

Re:I've been a software engineer for 10 years and I can't do... by pklausler on Monday March 06, 2017 @05:47PM (#13806799)
Nope, not kidding. A new grad with a masters in CS.
Re:I've been a software engineer for 10 years and I can't do... by xiphias on Monday March 06, 2017 @02:02PM (#13805098)
Actually this isn't a totally trivial question.

The time zones in calendar appointments can change, if there's a switch between standard time and summer time.

You need to know when is the hour set back by 1 hour, and in that case sometimes the answer is ,,maybe''.

I was working at a small phone company, and handling the switch between time zones were not just non-trivial, but they caused hard-to find bugs, as these things happen only twice a year.

Re:I've been a software engineer for 10 years and I can't do... by jamie_ca on Monday March 06, 2017 @03:01PM (#13805565)
Which is great, because you can pivot and expand on the question.

Once they've got the comparison out of the way, you can bring up those issues and see where they grow their implementation.