Wednesday, August 31, 2011

Chapter 2: The Infamous FizzBuzz

The FizzBuzz program is a problem that is used by interviewers in software development to determine whether an applicant can actually program. The reason it exists and is used in interviews is due to a belief that is held by many software engineering professionals: most so-called programmers can't write code at all.

So, as a software engineering student I guess it's a rite of passage that I provide my version of the FizzBuzz:

In the first implementation, I was simply trying to complete the requirements and see that the output was correct. After I started up Eclipse and created the project files, it took me approximately two minutes and thirty seconds to complete the program and verify the output. Because we had completed the problem in class a few days before, the completed code did not take very long at all.

In the second implementation I altered the code to make it more modular and organized. This practice lends itself to creating bigger projects with more lines of code. From start to finish this implementation took a little longer at about four minutes, but I think it is a more useful implementation than the first.

This exercise, though short, made me think about software engineering and how time is spent coding. Good code that scales well will save time in the long run though takes more time initially to write. However, bad code that is quicker to write initially could cost you a lot more time later on.

My hope for the future is that I will make it a habit to strive to write better code that is easier to read and understand, rather than simply find the quickest solution. Though I think I am still learning the basics of programming, I think this approach will pay off in the long run.

No comments:

Post a Comment