Saturday, August 29, 2009

Programmers Who Can't Program

It's ridiculous to even think that programmers who apply for jobs nowadays can't even program. Yet, according to this article at Coding Horror, many applicants are unable to create a simple program. FizzBuzz is a simple enough program with no tricks, yet most computer science graduates can't do it and some experienced programmers take 10-15 minutes. In ICS 613, we spent part of the first day writing (or in some cases, attempting) a solution on paper.
Of course, the two groups might have a few excuses. A CS grad might say that there's a lot of pressure when you're applying for your first job. However, solving a problem as simple as FizzBuzz during your interview is probably trivial compared to some of the problems you'll be dealing with on the job. If you can't handle this, how can you handle last minute fixes on a deadline?
An experienced programmer should not have any trouble approaching a solution. The only reason they'd take an extended amount of time would be if they over-thought the solution. Admittedly, I've been guilty of over-thinking problems, but 10-15 minutes is far too long. Seeing as how I'm not really an experienced programmer, I can't really say what takes them so long. Perhaps they need to gather requirements and use cases first.
When we wrote the solution in class, I certainly felt some pressure to do it quickly. As it was written, it was close to a solution, but it wouldn't have worked. After going over it and redoing it in Eclipse, it was really simple to do. The auto-compilation and error checking tools provided by Eclipse makes it really easy to program. Unit tests also make it easy to see if we get the desired output.
From that experience in class, I see that the class isn't about the programming. We can all program (I think), but can we apply that to the many potential problems and issues we may encounter while working on a large project? As a person who took the undergrad version of this class before, I know that we'll be introduced to many tools that'll help make our jobs easier. Learning how to apply these tools will be a major focus of the class.
Here's my solution as written in Eclipse. It probably took 2-3 minutes or so to implement and probably about the same to write my first incorrect solution on paper.


public class FizzBuzz {
  
public static void main(String[] args) {
      
for(int i = 1; i <= 100; i++) {
           System.out.println
(getFizzBuzzNumber(i));
      
}
   }

  
static String getFizzBuzzNumber(int i) {
      
if((i % 3 == 0) &amp;&amp; (i % 5 == 0)) {
          
return "FizzBuzz";
      
}
      
if(i % 3 == 0) {
          
return "Fizz";
      
}
      
if(i % 5 == 0) {
          
return "Buzz";
      
}
      
return String.valueOf(i);
  
}
}

No comments:

Post a Comment