The Non-Programming Programmer

Paul Jungwirth wrote:

You have the numbers 123456789, in that order. Between each number, you must insert either nothing, a plus sign, or a multiplication sign, so that the resulting expression equals 2001. Write a program that prints all solutions. (There are two.)
I think you meant 2002, not 2001. :slight_smile:

(Just correcting for anyone else like me who obsessively tries to solve little “practice” problems like this one, and then hit Google when their result doesn’t match the stated answer. :wink: Damn, some of those Perl examples are ugly.)

I once had the pleasure of interviewing candidates from the very bottom of the programming barrel. I rather enjoyed toying with these people… my favorite trick was to trap them and get them to back pedal to save face… for instance, I asked the question

  • me: "Rate your knowledge in javascript, 1 being very little, and 10 being Douglas Crockford"...
  • candidate: "Oh, definitely an 8"
  • me: "Really, that's excellent... tell me, how would you make custom object definitions in Javascript?"
  • candidate: "Uhhhh... uhhh".
  • me: "How about the prototype of a function, you ever hear of that?"
  • candidate: "Ummmm... no"
  • me: "Okay, well, in your opinion, what is the coolest thing you have ever developed using javascript?"
  • canidate: "UUUUUUUh, maybe my experience is only a 4..."

It was TOOO funny, and rewarding… and I got to end the interview right after that. I think taking an extra 5 minutes out of your day to absolutely CRUSH their false sense of superiority is well worth the time.

I was asked to write FizzBuzz (although without the words Fizz and Buzz) when I was interviewing for my current job. It wasn’t at the start of the interview, but it was the first part of the technical portion…

I can see Google Wave being useful for this, too, as more and more people gain access to it.

It’s not just “programmers” who fake it. Remember Frank Abagnale Jr., who, before his 19th birthday, successfully conned millions of dollars by posing as a Pan American World Airways pilot, a Georgia doctor and Louisiana attorney and parish prosecutor.

The account of his story was dramatized in “Catch me if you can” starring Leonardo DiCaprio

Crikey! And here’s me going for network support jobs and call centre gigs because I can’t find a coding position that pays the bills!

The numbers sound bad, but this article reminds me of a day some years past when our HR person came laughing to our office, telling that the company had just received an application for a C++ developer job…from a truck driver…aged 50…never worked on a computer…who had simply said in the application that he was bored with his current job and wanted some change.

Those were the mad dotcom days. No, wait! Those were the days almost half a decade after them. Maybe the news travel slow in the trucking business.

VarunKumar Mallisetty wrote:

I’m stunned to see that candidates are not able to write a program to find if a given number is prime or not.

Well, what kind of software is your team writing? If it’s mathematically based, or in a laboratory, then fine; they need a solid math background.

If your team is writing a payroll application or an ERP system, you are asking the wrong questions and potentially losing out on good developers. I’ve been writing lots of software for years as an in-house developer, and I couldn’t write nor care less about a program that tells if a given number is prime. It doesn’t apply to a huge segment of software developers.

@Paul Jungwirth
"You have the numbers 123456789, in that order. Between each number, you must insert either nothing, a plus sign, or a multiplication sign, so that the resulting expression equals 2001. Write a program that prints all solutions. (There are two.)"

So is this with left-to-right evaluation or with precedence (i.e. multiplication is done first)?

The point of the string reverse function is not to find out if the candidate knows the language. The purpose is to find out if the candidate understands looping (or perhaps recursion).

Leauki wrote:

For the interview purpose I would assume that a string reversal that
works on ASCII only is sufficient to show that I have an idea of what’s
going on. Framework-provided methods work on unicode as well.
Excellent, that’s why we use them.

Ugh. If anyone I had every use the reverse a string problem on had ever asked me about string encoding or mentioned the word Unicode or actually wrote the function to reverse a UTF-8 string in place. I would have died from shock right during the interview. Last time I did any interviewing only one person got the ASCII string reverse function close to correct. 60% of applicants did not answer the question at all.

Just out of interest has anyone ever had to reverse a string in place?
Apart from interviews I can think of a case in 20years of programming.

I have never had to test if a number is prime or write my own sort function either ( I did once have to write a hash for an embedded platform)

esm is right: I meant 2002, not 2001. I’m very sorry to anyone who wasted time because of my bad memory!

Paul

I suppose people with a computer science background have sort of a bias to some problems, such as finding primes of a number, that might look “hard” to anyone with a more trade schooly education. I think, though, if a programmer thinks that’s too mathy, there’s plenty of problems they’re going to run into in their jobs that will give them grief. It might “just” be business programming but that doesn’t excuse you from not knowing how to solve one of the very most basic calculation problems an interviewer could ask.

If you phrase the problem as such: Make a function that returns false if the number is divisible by any other (natural) number than 1 or itself.

You’re not seriously suggesting a competent programmer shouldn’t be able to do this right?

Ok I fail, did not know what “Sharding” is. Techies and their need for new jargon back in my DBA days we used horizontal partitioning and were happy about it.

@Hughdbrown

So is this with left-to-right evaluation or with precedence?

Assume ordinary rules of precedence: multiplication before addition.

For string reversal, if given a choice of any language and not allowed to use an API, I’d use python just to screw with you.

s = 'somestring’
print s[::-1]

I’ve encountered ‘language trivia’ interview questions too many times. Unless you’re explicit about wanting an algorithm (and most programmers would be explicit, or at least admit defeat when someone pointed out the vagueness), I would immediately jump to the shortest correct solution: built-in language features.

For the benefit of the non-programmers (like myself) that would like to learn to become good programmers, what practical advice can you give?

These days, there is a plethora of courses, books, websites, about programming, and an ever-growing number of programming languages. Being a non-programmer I find it difficult to distinguish between the good and the bad.

When I (try to) code, the biggest difficulty I find is knowing the “right” way to code, that is, my finished product does the job, but I have no idea if it is the most elegant solution, or the most secure solution.

Is there a book or course or recommended beginner’s programming language and approach that is best for non-programmers? I see a lot of books about how to code in this or that programming language, but very few seem to teach you the correct general programming approach, or use real-world examples that are useful.

Thanks all.

1 Like

You: “In any language you like (with no attention paid to getting every last semi-colon in the right place) write a function that reverses a string.”

Me: (writes a function that simply calls a standard library string-reversing function)

You: “Do not cheat and call your languages’ equivalent of str_reverse.”

Me: “Um… really?” (thinks for a moment) “Can I use my language’s implementation of a stack, or do you want me to reinvent that wheel too?”

You: “I think we’re done here.”

To understand why people try and get programmer jobs who cannot program, it helps to understand a common job tactic a lot of people use.

In most business jobs it is easily possible to fake out an interview and get a job you have no experience of. After three months most people have gained enough knowledge of the job to function to a degree where it is not worth firing the person. I have a few friends who have blagged thier way through whole careers using this technique.

Now to a person who has no knowledge of programming, they have no idea how easy it is to spot a rubbish coder in this industry, let alone a complete incompetent. But being a programmer is regarded as a lucrative career so people are going to try it on. Sad but true.

On the subject of having too many interviews I did read an only partially tongue in cheek method:

Divide the cv’s into two piles.
Bin one pile because you don’t want to hire anyone unlucky.

@Mary Contrary. I laughed with your “recommendation”. However, it reminds me of the “Tautology Club” xkcd comic from few days ago…