News for hackers. Stuff that matters.
Re:The Non-Programming Programmer by magoghm on Monday February 22, 2010 @07:43AM (#1142514)
This is one test I've used: write a program that reads a text file and then prints out all the lines in reverse order.
Re:The Non-Programming Programmer by jbellis on Monday February 22, 2010 @08:57AM (#1142617)
I love interview questions that make Python look awesome.
Re:The Non-Programming Programmer by Luyt on Monday February 22, 2010 @02:08PM (#1143443)

  python -c "print '\n'.join(open('file.txt').readlines()[::-1])"
Hmmm, slightly longer then the Perl version ;-)

  python -c "print '\n'.join(reversed(list(open('test.py'))))"
Somewhat more elegant, but still lots of parentheses.
Re:The Non-Programming Programmer by RiderOfGiraffes on Monday February 22, 2010 @02:36PM (#1143506)
It's also wrong - "readlines" keeps the "\n", and you've added another one between lines.
Re:The Non-Programming Programmer by Luyt on Monday February 22, 2010 @04:38PM (#1143799)
Indeed. A cosmetic refinement, but it should really be:

  python -c "print ''.join(reversed(list(open('test.py'))))"
That's even two characters less!
Re:The Non-Programming Programmer by spudlyo on Monday February 22, 2010 @06:36PM (#1144086)
Good, but too easy. Assume you can't keep the file in memory.
Re:The Non-Programming Programmer by msluyter on Monday February 22, 2010 @10:40AM (#1142864)

   perl -e 'print reverse <>' <file>
;)
Re:The Non-Programming Programmer by va_coder on Monday February 22, 2010 @01:35PM (#1143366)
Out of curiosity, why do you think questions like reverse a list without using reverse features of the language, or print out a file backwards a good judge of development skills?

I've been programming over 10 years and my opinion is that some of these questions aren't relevant for many development jobs.

Re:The Non-Programming Programmer by RiderOfGiraffes on Monday February 22, 2010 @02:40PM (#1143519)
Firstly, this is nothing to do about finding a good developer, it's to find out whether someone can program at all. I thought that would be clear from reading this thread, but perhaps it's now long enough that you haven't read it all, even though you have replied to a comment fairly deep in the hierarchy.

Secondly, this question didn't ask not to use the "reverse" features in the language. Indeed, the suggested solutions do use the reverse features.

Thirdly, perhaps this particular task is a good one, perhaps it isn't. Even so, it seems good enough to cull those who can't program at all. The point with these exercises isn't to get it right first time, it's to see if the candidate has a clue at all. If they get it right first time then you have a prospect. Treasure them and move to discuss design, style, ideas, and interesting stuff.

Finally, do you know any actively employed, productive developer who cannot write FizzBuzz in less than 10 minutes?

Re:The Non-Programming Programmer by va_coder on Monday February 22, 2010 @03:48PM (#1143674)
I don't even know if this is the answer. The reason being I have never needed to work with fractions or with the modulus operator (I'm 12 years out of school, which is the last time I need it). The only reason I know about it is because I was asked about a question involving the modulus character in an interview.

But I can tell you I have had many clients that have been happy with my work.

<code> for (e in 1..100) { if ((e % 3 == 0) && (e % 5 == 0)) { println "FizzBuzz" } else if (e % 3 == 0) { println "Fizz"} else if (e % 5 == 0) { println "Buzz"} else println e } </code>

Re:The Non-Programming Programmer by RiderOfGiraffes on Monday February 22, 2010 @05:03PM (#1143861)
Bingo.

That's good enough to avoid having your resume deep-sixed. The next stage would depend on the position you're applying for, and whether it's algorithms, web, systems, maintenance, whatever. There are now several questions I could pursue, but that's enough to get you through the door, offered a beverage of your choice, and effectively courted.

By the way, not knowing what the modulus operator is no bar - all you have to do is write:

    if is_divisible_by(n,d) ...
or something similar, and then say - "I'd need to look up the idiomatic way to do that in your language of choice."

But you are already way ahead of the game. FWIW, when we have been hiring (which we aren't now, by the way) the person who wrote something like that got the job. And yes, out of several tens of applications, only one could do it.