Why Can't Programmers.. Program?

“Do you even know how much you spend on the military ?”

thats because the EU doesnt spend its fair share on defence, and thus uses the U.S. military umbrella. therefore, the EU can spend money on welfare, socialised health and very little on defence. so , the argument is somewhat unfair when you stand back and look at the bigger picture.

So, you want a real Professional Association for Software Engineers, eh?

Some places are starting this. For example, the Canadian Council of Professional Engineers has started to certify Software Engineering as an actual Engineering discipline. (Like Civil, Mechanical, Electrical, etc.) That means that you will have to do the following to call yourself a Software Engineer in Canada:

  1. Get a 4-year degree, or 5 with co-op.
  2. Spend 4 years under the guidance of other Professional Engineers.
  3. Advance your skills over those four years.
  4. Take a Professional Practice exam.
  5. Have your character vouched for by four existing P.Engs.

By the way, there’s no damned way you’d use that swapping trick on an embedded system. You’re just asking for a world of pain.

First, there’s the obvious problem with overflow. Let’s say you want to swap 212 and 75 on an 8-bit system. Oops, you’ve just over-written your program somewhere.

Second, if you try to use cute tricks like that, there’s a chance that you’ll get interrupted in the middle and end up with the wrong values in your two variables. You can end up writing garbage - sometimes to ports. The correct answer is “You wouldn’t do that. It’s irresponsible.”

It’s like the

while( *p++ = *s++ );

strcpy code. Yeah, it works, but it’s the worst code in the world.

Chris I haven’t seen the card one either, but I don’t think you have to flip more than A and 3.

You’re testing “if there is a vowel, the number must be even” which doesn’t care what number pairs w/ consonants.

So A must be flipped to verify that the other side is even. 3 must be flipped to verify that the other side is NOT a vowel.

But there’s no need to check B - it has no vowel.

I assume the “trick” to the problem is the 2 card. You first think “Oh it’s even so I have to flip it.” But you don’t.

If you flip it, what do you get? If it’s a consonant, you haven’t disproved the theory, because it’s okay for a consonant to pair with an even number. If you see a vowel, you have some additional annecdotal evidence to support your theory, but nothing that really means anything.

I must not be in the top 0.5% of programmers, because I’ve been on more than one or two job inteviews… and I tell you, most of them were terrible at assessing my abilities to think and to code.

After walking out of several interviews convinced the company had done nothing to distinguish me from a tree stump, I got to the point where I almost wanted to shake the worst interviewers and shout “ASK ME SOMETHING HARD!”

I think the only real solution is to make programmers be licensed professionals that need to periodically prove that they have the skills their resume says they do.

I envision something like the Blacksmith Guilds of old :wink:

swapping without using a temporary generates more code than using a temporary.
http://www.codingaway.com/2007/01/31/is-swap-without-temporary-a-good-idea/

Its wrong to think of solutions from programming perspective. I mean why should I know how to use recursion to solve a “real” problem?
First we should be able to define the problem then find the best possible solution…recursion or no recursion.

I had to do the swap-2-numbers thing back in 1973 on a PDP-11. I had forgotten the method. As for recursion, it’s good for tree population and list containers.

“mtrpcic on February 27, 2007 08:51 AM”

you’re wrong. you didnt start at 1

I 'd love to see a COBOL implementation of Fizz Buzz here.
And dont cheat. Code must be runnable with cut-paste. You know what i mean. Mandatory divisions-sections, proper line positioning and stuff… He he…
Assume the ANSI 85 standard. Anyone?

My favorite posters are those who lambast others’ fizzbuzz programs, then go post their own incorrect solutions.
Like “mtrpcic” above. Too funny…

FH wrote: “On recursion, I stand by my advice to students. You should know what it is, how it works, and how to program it. But you should never use it in production code, because whoever maintains it may not grasp what is going on.”

“Never” is a bit strong, but think you are closer to right than to wrong on this one. Perhaps in a perfect world everyone would be fluent in recursion, but in the real world you are likely to be causing maintenance problems for all but an elite few if you use it.

More importantly, you are clearly thinking about maintenance issues and teaching to them in class. If your students graduate and find themselves in a situation you didn’t cover in class, which they will, then at least their heads will be in the right place to start with.

@Patrick

But there’s no need to check B - it has no vowel.

You’re right. I reread it, and caught myself expanding “one side” and “other side” into an iff scenario.

The original premise is: “one side vowel” - "other side even"
The only other logically equivalent statement is: “one side not even” - “other side not vowel” (equivalent to “one side odd” - “other side consonant”)

So, you’d have to check vowels and odds, or “A” and “3”

My original problem with the question still holds though. You have to assume a particular level of precision in writing on the probelm writer. Do they really know the difference between if and iff?
You might be caught on an off day for that sort of a problem. Will you be doing minimal test scenarios yourself all the time with no opportunity to come back when you’re feeling “not so dumb”? etc

David,

Regarding the executable line noise version. It was intentionally ugly. When I professionally worked in perl environments (for about 8 years solid), my perl was quite clean and organised. Were it not for the excessive perl punctuation you might confuse it with clean Java code. I know I could’ve written it over a series of lines, etc., but that wasn’t the point. I’m not a big fan of obfuscated code but in something as simple as the fizzbuzz exercise, I was just pointing out that it can be accomplished in what is essentially one command, not actually a code block. The only reason that the {}'s were included is because it is necessary in a for loop.

And yes, I agree that 3-level deep nested in-line conditionals are ugly and if I ever found any used in production code within our subversion repository, I’d have the person responsible taken out behind the shed and thrashed with a switch.

Eric

Your tests do indeed screen out people who cannot code without a computer. If part of the job requirement is writing coding without a computer then I guess this is a good test.

Most programmers (myself included) write code on a computer and don’t have the visualization skills to program on paper. Whenever I get these questions in an interview I reply that I don’t code on paper and if they want an example of my coding, they can give me a problem to solve and a computer to solve it on.

Wow, and the elimination of indentation made the whole thing look like garbage!

I don’t believe the 199 out of 200 statement.
My experience as a manager and programmer is that
only a very few candidates can’t program.
I’ve had exactly one instance in interveiwing
about 200 people over the years where the person
said they knew SQL and when I asked them to write a simple
SELECT statement on the board, they admitted they didn’t know
SQL that well.

Now I have seen lots of programmers that simply were very poor programmers. It is rare to find a self motivated, can-do type of programmer that comes up with a good solution without any coaching.

I like FizzBuzz, though there’s something to be said for jumping straight to a pointer/recursion screening question.

I’m not so fond of the “swap two variables without using a temporary variable” question. There’s several possible outcomes of asking it.

  1. The candidate can answer the question correctly:

1a) …because the candidate has seen the trick before. Chance of hiring: Unchanged, because we’ve learned nothing useful.

1b) …because the candidate has enough mathematical sophistication to solve the problem from scratch. (All you need is an algebra with a binary operator and inverse elements[1].) Chance of hiring: Increased.

  1. The candidate can’t answer the question correctly:

2a) …because the candidate is a poor programmer. Chance of hiring: Decreased.

2b) …because the candidate is a good programmer who doesn’t see the trick, and isn’t quite clever enough to derive it from first principles. Chance of hiring: Increased (for most jobs).

The scoring matrix is all screwy here: Some bad candidates answer the question well (a subset of 1a), and some potentially good candidates miss it (2b). Now, you could argue that for some jobs (say, programming at Google), you don’t mind losing the competent but mathematically weak programmers in group 2b. In that case, the scoring matrix is a little better, but it still doesn’t distinguish between group 1a and group 1b.

If you really want to hire exclusively from group 1b, you’d get better results by asking a straight-out math question.

[1] The inverse elements allow you to rewrite “b=a-b” as “b=(-b)+a”, which gets rid of the compiler-allocated temporary variable that some architectures require for “b=a-b”. Of course, signed C integers aren’t closed under addition, so you’re better off using xor for this trick.

It’s not “can you program in X language” but “Can you program in ANY language” or even a psuedocode that is reasonably similar to the target language?

If the target language is C, don’t fault a guy who hasn’t touched C in 3 years and forgot the syntax of a for loop. If he can show you he knows the key concepts of programming in a procedural language don’t reject him out of hand.

If the target language is Prolog or LISP, knowing ONLY C or another procedural language may not be a lot of help.

Two exceptions: If you need him to be pumping out code at full speed in the first 2 days, you need someone who really knows the language now. If you need full speed within a week, you know someone who really knew the language at one time. With anyone else, give them a couple weeks and they’ll be up to speed.

This post is like making a comment on a Star Trek forum about the guy in the yellow shirt that dies on the away mission.

Alright, well, as a current computer science major with 8 years real work experience under my belt, I can tell you this: People are persistent. They’re just not willing to admit they cannot do something. Often times this means some CS majors spend 40 hours on simple 100-200 level projects… and pass the class. You’d think the theory would weed them out, but let’s face it, college is geared towards those who study for the test. After the test is complete, who cares, right? “I’ll never see recursion again!”… uh… no. I’m actually astonished how many of your commentators have already said they don’t use it. Some have gone so far as to say that even if you do understand recursion and it makes the best code, it’s better not to use it for the sake of the idiot they hire to maintain your code…

… What the hell? I’m a web developer and I use recursion a great deal, and in ways most people wouldn’t consider. I understand that it can actually be a performance hog many times, but if you have a deep underlying knowledge of how the server handles memory, this shouldn’t be a problem.

Where is the respect for our trade? Do we really want to cater software development to the lowest common denominator of coders? Every single test I’ve taken to land a job has been so easy it made me insulted they asked. I decided to take an internship this past summer, for example. In one of my interviews (as a web developer for the Tools department of AOL), they tested me to ensure I knew that GET and POST existed… not when to use them… not how to use them… not even what they were. They just wanted to know if I knew they existed.

As a web developer, I almost assume any applicant would know this just by applying for the job.

I didn’t take that job. That kind of question almost guarantees bitch work. Instead I went with the interviewer who asked me questions I didnt know… like what port is used for DNS UDP. And sure enough, that job gave me more freedom, and plenty of good honest to god work experience. I talked to the intern from tools, and yeah, bitch work. In fact, I received 4 internship offers from AOL that summer and two job offers which I turned down… more than any other intern there to my knowledge. And what’s my college GPA?


2.10

Yeah, I’m not doing so hot in school. Why? I can’t really give a good excuse. Laziness is my only reason. I can’t seem to drag myself to attend a class I can just as easily teach myself in a matter of days yet somehow takes our class an entire semester and people still do not get it.

Some people, such as my roomate right now, will graduate with near 4.0 GPA’s and will not be expert programmers. What a waste of 4 years, if you ask me.