It’s time to start applying for a software development job. Let’s find all the old projects, put some comments on them and host them. Let’s dig into our old class books and notes reading all about binary search, bubble sort, trees, arrays, etc. You are sitting in front of a whiteboard ready to be quizzed. The first question asked, “FizzBuzz!”!
What is Fizzbuzz?
Fizzbuzz is a very simple programming task that is used to see if the interviewee knows how to write code. The task is as follows:
Write a program that prints the numbers from 1 to 100. If the number is a multiple of 3 print “fizz”, if the number is a multiple of 5 print “buzz” and if the number is a multiple of both 3 & 5 print “FizzBuzz”
Of all the topics, Why is this a leading question?
To start there are tons of implementations in every language. Some are jokes and others are legit optimized forms of code. By asking the question you can notice some stuff right away. First the obvious, does the interviewee know a language and it’s syntax? Do they understand the problem well enough to answer it? If not do they have the character to ask questions. So a language is picked, the problem is understood and the code is written, does it compile? It compiles, so everything is off to a great start. At this point most interviews will move onto another question or topic. Some dig deeper. Now we can look at how optimized the code is. First, can the code be condensed, do lines of code repeat? Start thinking about how you can condense that code. Can you pull out parts of the code into it’s own function, Can you use a switch to remove extra math? What next, the code is looking nice, it’s clean and to the point. Maybe we can take it a step further. Let’s remove the hard-coded constants and make them parameters. Now Fizzbuzz can be boobam or foobar. The code is now modular. Neat. Now you really want to impress the crowd. Let’s make this baby functional. Our function is printing out values. How about instead of printing within itself, we return the values and then print them out, write them to file, flash them on screen, or really do whatever we want. Finally we want to polish this up and package it for the market. Other developers need to know what is going on. So write up some tests and comment the code. Provide some sample values and tuck all that logic in a namespace.
Man look at that, what went from a simple mod 3 mod 5 simple printout, now shows that you understand so many concepts of programming. You started simple and whittled it into code perfection. That should shock some interviewees.