Tuesday, August 30, 2011

Pop the FizzBuzz in Eclipse

Let's recall the first day of class: sit down, take out a sheet of paper, write some random program, raise hand to see how fast you finished. Well, this assignment is that random program called the "FizzBuzz" program. This program should print out all of the numbers from 1 to 100, one per line, except that when the number is a multiple of 3, you print "Fizz", when a multiple of 5, you print "Buzz", and when a multiple of both 3 and 5, you print "FizzBuzz". Instead of writing the program on paper, we needed to compose the code on eclipse and time ourselves to see how long we take to complete it with the correct output. So lets start now…

(types on the keyboard).

Time's up! Five minutes and 53 seconds. Wow. So does it work? Well, from a view point, the output looks correct. The overall code is similar to that we went over in class. There are two methods in my program rather than one. The first methods takes in a number and returns an output depending on the number such as numbers being a multiple of 5 returns "Buzz". The second method is the main method that is the basic loop of the program from 1 to 100. This method calls the first method and prints out the output.
Overall, I am satisfied with the code I wrote. I could have made a one method program that would have been faster to write, but having this second method could ensure correct output with a test program. Coding the program went smoothly and I did not run into problems with eclipse. I do notice that I take my time to choose variable names and try to make them specific, rather than one character names. The only thing I think I could improve on is to rely less on eclipse. Having used ellipse for several semesters, there are many shortcuts to do a task. Maybe that's why I took a while to write this code on paper. I've become too dependent on eclipse over the years.



4 comments:

  1. You should depend more and more on Eclipse. I use Eclipse everyday at my company. Learn CTRL+SHIFT+G, for instance.

    ReplyDelete
  2. Hi Elmar. I was wondering why you say relying less on Eclipse be an improvement for this assignment, especially if it provides many shortcuts?

    ReplyDelete
  3. When I was writing this up, I was thinking how I did on the quiz we took in class. After being so use to eclipse, I forgot what to type in front of main. No really. I was like... public, something, something, blah main (Stringy stuff). What I was probably trying to say in this entry is that you shouldn't depend on eclipse on the simple stuff, let it help you with the more complicated things. Imaging being in an interview writing code without the help of eclipse and only a sheet of paper and pencil. I use eclipse too much that I sometimes forget how to code myself.

    ReplyDelete
  4. Why is Dr. Johnson giving your class katas like FizzBuzz? It's too damn simple. He should give you all more challenging katas, like the ones I did on my blog here:

    http://www.thetravelingcs.com/search/label/katas

    Tell Dr. Johnson to turn up the heat.

    ReplyDelete