If Google went down, would you still be able to code?

Anime Godzilla

Godizlla, destroying Tokyo (credit: Steven Stahlberg)

Folks, assume one day that the monster to my right managed to grab a hold of our cities and was destroying Tokyo. Then assume that Megatronus Prime had taken hold of the internet (pictured below) and has destroyed it. In this grim, but extremely realistic situation, you are assembled as part of an elite team to create a software that has to remotely revive the interenet, but get this, you have to use balanced B-Trees and doubly linked lists, and worst it has to be TEST DRIVEN!! (Cue dramatic horrifying music not heard since A Nightmare on Elm Street). Google, the almighty being, now seizes to exist on earth, despite it’s existence on other Galaxies through the Quantum Nonlocality paradox.

Amid all this confussion, the question is, would you be able to code? The answer is … (cue some more incredible dramatic music not heard since The Slumber Party Massacre) … we just don’t know! No, actually we do, because 99 Out Of 100 programmers can’t program, therefore statiscally at least, you cannot program.

Megatronus Prime

He might get a hold of our precious, the internet!

Why am I bringing this up you may ask? Well for starters, I am a web trader, and I do think about these things quite often. As detailed here, I too struggle with peace pipes and co on a daily basis. Furthermore, a murky web trader recently challanged me to solve the FizzBuzz problem without using google, test driven, in 15 minutes… I failed, it took me 20.

The FizzBuzz problem is a rather common problem in the UK failed education system. Young hackers students are asked to write a program that will print numbers from 1 to a 100, but when the number is a multiple of 3 it should print ‘Fizz’, when it’s a multiple of 5 it should print ‘Buzz’, and when it’s a multiple of 15 it should print ‘FizzBuzz’. A simplified solution would look like this:


String output="";

for(int i=1; i<=100; i++){
if((i % 3 == 0) & (i % 5 == 0)) {
output+="FizzBuzz";
} else if (i % 3 == 0){
output+="Fizz";
} else if (i % 5 == 0) {
output+="Buzz";
} else {
output+=Integer.toString(i);
}
}

System.out.println(output);

The Internet

The Internet, it must not get in the wrong hands

The idea of the problem was to be agile though, and thus to create a FizzBuzz application using TDD. To do that you’d have to create the tests first (duh!), and then create a method that generates the output as a string. The tests would test for the different possible outputs (integers, Fizz, Buzz). FizzBuzz would then be an object. A decent solution that I “later” found online was this.

The moral of the story my followers friends is: Use Google while you still can, because one day and we all know its going to come, Cybertronian Tanks and Kaijus will take over the globe and threaten our existence. If you were on that elite ninja team of coders, you better do us proud, you better FizzBuzz!

Actually no scrap the last paragraph, even a small child will tell you Kaijus and Cybertronians hate each other, thus they will most probably destroy each other before the internet is harmed, but still humanoid, YOU HAVE BEEN WARNED, start learning how to code without Google.