News for hackers. Stuff that matters.
Re:The Surprising Number of Programmers Who Can’t Program by stronglikedan on Friday August 23, 2019 @10:49AM (#20778196)
> FizzBuzz [...] You wouldn’t believe how many people can’t do it.

This is so true. IME, less than 50% of applicants can even get close. Mostly due to not remembering or even knowing about the modulo operator or a suitable workaround.

Re:The Surprising Number of Programmers Who Can’t Program by chadash on Friday August 23, 2019 @11:00AM (#20778320)
I've had the same experience. I can forgive an interviewee for not remembering what symbol the modulo operator is, but not for not knowing what it is in the first place.

I've had the same experience asking applicants to reverse a string in a language of their choice. sometimes they'll give me a simple answer like "''.join(reversed(my_str))" (python), which i'll accept and move on to the next (harder) question, but even if you don't remember that syntax, you should be easily able to build a function using a for loop. I find that 50% of applicants can't and it saves me a lot of time finding this out early in the interview process.

Re:The Surprising Number of Programmers Who Can’t Program by carapace on Friday August 23, 2019 @11:33AM (#20778650)
I can't help myself: In Python to reverse a string (or other sequence)...

    In [1]: "?he ,taeN"[::-1]
    Out[1]: 'Neat, eh?'
Re:The Surprising Number of Programmers Who Can’t Program by guiambros on Friday August 23, 2019 @11:45AM (#20778768)
True, but remember that:

Explicit is better than implicit.

Readability counts.

Re:The Surprising Number of Programmers Who Can’t Program by quazar on Friday August 23, 2019 @11:45AM (#20778779)
Pythonic way to reverse a string would be my_str[::-1].
Re:The Surprising Number of Programmers Who Can’t Program by mysterydip on Friday August 23, 2019 @10:53AM (#20778244)
If mod isn't something needed for whatever their normal work is, is it a valid test? Or are you potentially throwing away otherwise good candidates because of it?
Re:The Surprising Number of Programmers Who Can’t Program by patio11 on Friday August 23, 2019 @11:07AM (#20778385)
In my experience one sees roughly similar results with:

"Write a function which counts the number of a's in the input string."

"We will give you an array of words. Print out each word which appears more than 3 times in the array."

"We will give you two arrays of words. Print out each word which is in exactly one of the arrays."

It's not just the mod operator. These are toy problems for difficulty but they're not "implement the rules to a children's game"; with a few seconds of effort you can describe a boringly plausible business reason for having to implement them during a fairly pedestrian career.

Re:The Surprising Number of Programmers Who Can’t Program by ciao_ciao on Friday August 23, 2019 @11:48AM (#20778816)
Bear with my potentially dumb solution, but i'm trying to understand what an interviewer would look for in answering questions like these. For the third, in python, could you make both sets and print the symmetric difference? Does this (a) demonstrate practical knowledge of python or (b) necessitate a follow up from the interview to provide a solution that does more of the "work"?
Re:The Surprising Number of Programmers Who Can’t Program by wikwocket on Friday August 23, 2019 @06:09PM (#20783177)
Since these are riffs on fizzbuzz, the goal is just to evaluate whether a candidate can use programming to solve these at all, i.e. whether they can 1) think through how to accomplish a basic task with some data and code, and 2) implement it in a language they know.

The goal of fizzbuzz in a phone screen should not be to see if someone can solve it in an optimal memory-efficient framework-idiomatic way. Clever syntax and data structure use is lovely, but these are really about finding whether someone can use a 'for' loop and an 'if' condition.

Re:The Surprising Number of Programmers Who Can’t Program by jdboyd on Friday August 23, 2019 @12:43PM (#20779406)
If they take that shortcut in Python, it tells you that they probably know Python, which also likely suggests they could think it out if they had to. If they think it out the harder way, that shows they can do that, which suggests they can get some things done. It isn't rare to find applicants who have more than 10 years of experience who somehow can't do either.
Re:The Surprising Number of Programmers Who Can’t Program by blunte on Friday August 23, 2019 @11:30AM (#20778631)
The thing is, you don't need mod. You can, in more steps, arrive at the same output just using arithmetic. But everyone... non-programmers too... should understand the concept of "remainder after division" (of whole numbers).

If the test is interactive, the candidate can express, "I need to find out if this number is evenly divisible by that number; if so, then blah blah". Interviewer can remind them that x % 2 is "remainder of x when it is divided by 2". The point should not be whether someone can remember %, but whether they have any idea what minor goal they are trying to achieve.

Re:The Surprising Number of Programmers Who Can’t Program by 0x5002 on Friday August 23, 2019 @11:25AM (#20778576)
I would argue that every single programmer with at least the tiniest bit of tenure in the field (or a kid straight out of college who took at least some math classes) will have run into this at some point in their life.

Even if you (somehow) don't know about it, figure something out? Do something "stupid that works" like this:

  def floatcheck(x:Float, div:Int): String = (x / div).toString.split("\\.")(1) match { 
      case "0" => "int"
      case _ => "float"
  }

  (1 until 100).foreach(e => {
   if(floatcheck(e,15) == "int") println("fizzbuzz")
   else if(floatcheck(e,3) == "int") println("fizz")
   else if(floatcheck(e,5) == "int") println("buzz")
   else println(e)
  })
(I'm guessing this works, or maybe I fall into that category as well ;))
Re:The Surprising Number of Programmers Who Can’t Program by probablybroken on Friday August 23, 2019 @11:25AM (#20778578)
You probably are rejecting potentially good candidates, but I would personally suggest that of the developers that I want to hire, most of them are members of the set of developers who know what the modulo operator is for. And since hiring is a numbers game, it seems like a reasonable filter. Besides, you are allowed to ask other questions in the interview.
Re:The Surprising Number of Programmers Who Can’t Program by ecpottinger on Friday August 23, 2019 @11:08AM (#20778396)
I never use the mod function, and I still could do this test.

You are being tested on finding a solution that works, not on what function you use.

Re:The Surprising Number of Programmers Who Can’t Program by jppope on Friday August 23, 2019 @11:20AM (#20778528)
Re:The Surprising Number of Programmers Who Can’t Program by kjeetgill on Friday August 23, 2019 @11:18AM (#20778508)
I think this is becoming less true, but I think it was (rightfully) seen as a test of basic competence. Would you hire a chef that didn't know what a fork was even though you never use one to cook?

I had to learn C at some point though, and that used to be common. I suppose it's becoming a less useful test.

Re:The Surprising Number of Programmers Who Can’t Program by JimBrimble35 on Friday August 23, 2019 @11:05AM (#20778360)
I've written tens of thousands of lines of code, solved a plethora of complex problems, worked on a number of projects from requirements to production in an assortment of different languages and technologies and I can count on one hand how many times I've had to use the modulo operator.

This is first year-out-o-school, junior gate-keeping bullshit. We need better methods to evaluate intermediate and senior devs, and FizzBuzz ain't it

Re:The Surprising Number of Programmers Who Can’t Program by ecpottinger on Friday August 23, 2019 @11:10AM (#20778418)
And if the only way you can think of to do this program requires to do the mod function, you are not that good a programmer.

Think solutions.

Re:The Surprising Number of Programmers Who Can’t Program by jppope on Friday August 23, 2019 @11:20AM (#20778532)