Why Can't Programmers.. Program?

Spencer asked “Does anyone have a link to more programming exercises that I could do?”.

Check out www.projecteuler.net - The problems posted there require short programs but most also require a lot of thought. Depending on the language you use, you might have to borrow or write your own large integer class.

I think interview testing can be useful for both the employer and candidate. As a candidate for a job, I always give the following test to the employer. It is very simple:

What do the following acronyms stand for and if you get that far then give me a one-liner describing each:

SRP, OCP, DIP, LSP, ISP

If one or more of the technical people at the potential employer knows what these acronyms stand for and, even better, they know what they mean then I will consider working for them.

Never let the interviewer ask all of the hard questions.

You all have it wrong, the answer is simply:

System.out.println(“the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.”);

duh…

I welcomed Jeff’s mention of FizzBuzz. As a novice (and I mean brand-spanking new) programmer being given a “challenge” like that is fun. Currently, I’m in college taking some programming courses. We’re learning C# and ASP.NET. So I wrote my own little solution to FizzBuzz in C# via ASP.NET. Even though Jeff’s remarks about developers “feverishly posting solutions” is funny, I rather liked seeing how others did it. I realize that with every problem there is more than one way to do it. What really got me confused was trying to figure out what language each poster was using.
Does anyone have a link to more programming exercises I could do? The exercises from the book aren’t “real” enough. They ask me to create snippets of code that do something that really isn’t useful, but it does test to see if I learned the topic from that chapter. I’d rather make something semi-useful rather than "Create a page in ASP.NET that displays a pop-up message when you click the button."
Thank you in advance.

DarkChucky - that won’t work. The situation where it’s a multiple of 3 AND 5 will fall into the first part of the if and never make it to the i%5==0 i%3==0 line. That check needs to be first.

Hey Stu,

It took me 13 years to get a 2 year degree in Data Processing (they didn’t call it “Computer Science” back then). Can you infer my intelligence from that? Can you infer my programming skills from my failure to be able to add in hex?

Basically I am a self taught Software Engineer.

Today, I am an independent (currently writing map and delivery software). I charge $127.00 an hour. I have clients banging my door down. They are referred to me by previous clients because of the work I did for them.

So, to the employer who hired the geek, you probably made a good choice. But how many “great” choices did you pass up because they didn’t pass your ‘brain pan’ test?

I still can’t add in hex. And I still don’t care…

Respectfully, laughing at your ignorance, all the way to the bank…

Now, what worries me is that I’m a designer and I could answer to the questions such as FizzBuzz and some dealing with recursion…

I’ve only been programming a little under a year, but I don’t think that I could do the FizzBuzz program off the top of my head. Why? Well, the idea of the loop is simple enough, however I have NEVER needed to know if a number was divisible by another, so I have no idea what function finds that for me. If I were given the chance to look that part up, then I wouldn’t have any trouble.

Amazing. The comments on this thread are full of people criticizing the article, but it seems like most of the code examples posted here appear to completely back it up! It is shocking how many of the “coders” that posted here did not do simple things like initialize their variables - resulting in code that counts from 0-100 (read that as false positives since 0 mod 3 and 0 mod 5 = 0) - or display ALL numbers INCLUDING multiples of 3 and 5.
Maybe the problem is not so much that most “programmers” can’t code, but that they can’t follow directions.

WHERE IS THE COBOL?!?!?

Man, it’s been years…


  • This is what a cobol program used to look like…

*First you had your variable declaraction section or something…

WS-COUNT-LOOP = TYPE INTEGER;

bla bla bla!! Man, I can’t remember it at all… had to learn that stuff freshman year…

^ Need I say more? ^

its probably due to the fact that most web app programmers dont have to do lame-ish tasks like that

Speaking as a newly hired entry-level programmer, I think this post is completely ridiculous. I wasn’t able to answer your FizzBuzz question very quickly (although the logic of it was obvious), but I was recently hired by the IT division of a top I-banking company anyway. What’s more, I don’t think they cared if I could code that well yet. What’s more than more, I think they were correct not to.

I’ll be honest, I didn’t think I would get the job. I’m not even a CS major (Math major, CS minor). But they hired me because I’m smart and demonstrably trainable, and have passions outside academia. Basically, I represent a low risk. They can train me however they need to and feel comfortable in the belief that I will be able to contribute. But the fact that they have to train me is not my fault. Schools don’t teach students how to code anymore, don’t you all know that? How can an institution like that keep up with all the changes in programming that happen so, so fast. Do you know how much php, ajax, C, C++, perl, FORTRAN, COBOL, or Ruby I was taught? None, nada, zilch. It was “on me” to learn these languages if I needed them for an assignment, which was rare. The only thing I was taught was Java, and not very much of it.

However, what I WAS taught was theory and architecture. Heaps, stacks, linked-lists, graphs, hash-tables, classes, inheritence, search trees, Big-O, min-cuts/max-flows, database management, logic and set-theory, optimization, and all the basics of data architecture. Hell, I know more Assembly than I do C++!

This knowledge spans all disciplines within computer science and any language. I might’ve gotten a job designing websites for a 2.0 or helping to manage a database for a bank. There’s just no way to know how I was to focus my college studies, so I was given the big picture instead. I think this will work, I’ll find out for sure soon enough.

Java:

    String s[] = {null,null,"Fizz",null,"Buzz","Fizz",null,null,"Fizz","Buzz",null,"Fizz",null,null,"FizzBuzz"};
    int i = 0;

    for (int count = 1; count =100; count++) 
    {
        if (i  15) 
        {
            if (s[i] == null)
                System.out.println(count);
            else
                System.out.println(s[i]);
        }
        else
            i = 0;
        i++;
    }

Jeff, having ‘programmers’ attempt to write this type of program in an interview surely will weed out a crap load of candidates…but just because you can write the FizzBuzz program within a couple of minutes on a piece of paper doesn’t really mean much either.

From what I can see it only means you understand IF statements and comparison operators. I know designers who are crafy at coding JavaScript who can pull this program off in 5 minutes but I wouldn’t dare consider them for a real programming job. Why? Well this is just really the tip of the ice-berg…and I liken being able to code this statement as someone capable of changing their car’s oil. Which by the way a crap load of people can’t do either. Of course would you call the few souls who do change their oil mechanics???

-Ralph

Jeff,

The ADO.NET Orcas Entity Data Model will significantly reduce the code required for both Fizzing and Buzzing activities. Additionally, you may gain value from the ASP.NET AJAX Framework, which can update your end user’s page with Fizzes and Buzzes as they are computed.

Hope this helps,
Scott

Far too many comments for me to read through, so forgive me if this has already been stated.

Regarding the no-temp-variable swapping: For one I don’t think this says anything toward or against anyone’s programming ability. Especially since the solution offered won’t work in every case.

The biggest flaw with the plus/minus solution is that overflow can and will occur for large numbers. The better solution is to use three XOR operations. And even that obviously wont work for non-numeric variables (strings, objects, etc).

And it appalls me to see so many people actively not using loops and calculation in the FizzBuzz problem. (i.e. the people listing "print 1, print 2, print “fizz” … etc.) If I were hiring a developer and had a candidate that said outright “I don’t know” versus a person who did this, I’d take the “I don’t know” guy/gal.

I agree with the one who says, if u want a good programmer, don’t put the contraint (must hire only graduates), being one does not guarantee success at all. I code since 1990 and have seen lots of good software developers and most of them where just self-taught. Important organizations have lost worthy resources because they were asked to hire graduated people just to fulfill requirements for the job’s description. FizzBuzz test can be a good thing but it cannot be the only thing to test a good programmer, because some clever minds owners that don’t have resources to get a degree may be awaiting for someone to help them launch the rocket, then they will take you to mars and venus, who knows, but If you don’t give the chance, someone else will do.

The question I asked many candidates was

Write a function to test if the argument is part of the Fibonacci sequence.

Many candidates don’t know where to start.

But not 199 out of 200.

Is HR not screening anyone out for you?

Far too many comments for me to read through, so forgive me if this has already been stated.

Regarding the no-temp-variable swapping: For one I don’t think this says anything toward or against anyone’s programming ability. Especially since the solution offered won’t work in every case.

The biggest flaw with the plus/minus solution is that overflow can and will occur for large numbers. The better solution is to use three XOR operations. And even that obviously wont work for non-numeric variables (strings, objects, etc).

And it appalls me to see so many people actively not using loops and calculation in the FizzBuzz problem. (i.e. the people listing "print 1, print 2, print “fizz” … etc.) If I were hiring a developer and had a candidate that said outright “I don’t know” versus a person who did this, I’d take the “I don’t know” guy/gal.

i haven’t used MOD since my vb.net class. and it’s never come up in the real world so far, so, i might just have tanked on the question.
i know in an interview once i was asked how i would reverse a string in vb.net - and my brain went thru getting the length - then setting up a loop etc and on and on. and later i learned there was already a function in the language “StrReverse”. so, i can see how it’s pretty hard to set an interview test to target a potential employee’s experience. the best interview i had, they gave me a pc, Visual Studio 2003 + sql server 2000 and said you’ve got 45 minutes, here’s the sa login. make a web application that pulls this and that. no inline sql (only stored procedures and they wanted it in tiers [data-access, business logic etc all in separate assemblies). i aced that in 25 minutes. but, i had been programming like that (at the time) for two years. i’m afraid that would be easier for me than FizzBuzz.