
Oh, Go Ahead, Overthink FizzBuzz (2008) - ingve
http://chalain.livejournal.com/68788.html
======
MAGZine
The EnterpriseQualityCoding version of FizzBuzz[0] is the ultimate (hilarious)
version of this. Though, there is still some room for development of node, js,
etc versions.

[0]
[https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...](https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition)

~~~
xirdstl
I don't know. Java seems like the one true language for the Enterprise version
of FizzBuzz.

~~~
ashark
The Node version could be pretty great anyway. Huge list of modules required,
multiple implementations of the same basic thing in use, separate modules for
"fizz" and "buzz". And MongoDB used for something, for no good reason.

~~~
munificent
"fizz", "buzz", and "fizzbuzz" should be separate microservices each with
their own failover and redundancy systems.

~~~
mbrock
Many years ago I stumbled on a programming golf contest on the old Something
Awful forum. The challenge was to convert a byte string to a hex dump. I wrote
it as a distributed JNI system with CORBA based RPC. The boilerplate stuff
alone was like 500 lines. This is what I did for fun in high school. I wasted
my youth.

------
russnewcomer
I worked for a while for an IT services company. For our entry level tech
support position, I put together a quick interview document that we emailed
applicants, asking them 4 questions. They had to help someone fix their
printer via email, fix their email client, write a powershell script to copy
files from one directory to another, and solve FizzBuzz.

We honestly didn't care if they blatantly plagiarized the answers (especially
on the last two), because the point was the right answer as much to see if
they knew enough vocabulary to know how to Google the question.

Out of 30 responses, including recent college graduates with good GPAs, people
claiming 20+ years of IT experience, owning their own IT consulting firm, etc,
not one of them got all four right. Some even said, "I don't know how to solve
this" on FizzBuzz.

The person who actually got them all correct? My wife, an ESL teacher who I
gave the questions as a control, and told her to not spend more than 15
minutes on them.

Anyone who overthinks FizzBuzz is an automatic hire in my book. (yes, I know
about
[http://www.joelonsoftware.com/items/2005/01/27.html](http://www.joelonsoftware.com/items/2005/01/27.html)
)

~~~
ceejayoz
In fairness, someone with 20+ years of IT experience could very legitimately
not have needed to do any significant amount programming. Maybe they built
servers all day.

~~~
russnewcomer
In general, I would agree with you. In that particular case (which I remember
because the person with 20+ years of experience was recommended by a client),
that person claimed they had written their own CRM system.

(Way, way off topic, but are you the ceejayoz who used to be a Homeworld
webmaster? I spent a month or so of my life on Homeworld in late 2000, fun
times.)

~~~
ceejayoz
That definitely changes things.

And yes, I am. :-)

~~~
russnewcomer
Yeah, we only gave that candidate the document because we were had just come
up with it, we figured he would completely ace it. When he came back with
really bad answers for all of the questions (including, "I've never heard of
Powershell and I'm not sure how I would use it to do this" in 2012 with
claiming the last 10 years as a Windows admin), my boss called me into his
office and we just stared at the answers in shock.

Awesome. I was a bigger Total Annihilation fan/community member than I was for
Homeworld, but still, it tickles me when I see names I recognize from gaming
being 'real people' somewhere on the internet years later.

------
matchagaucho
I used FizzBuzz when interviewing candidates at Facebook.

Call it over-thinking, but I preferred to think of it as "jamming"... like
calling out a Jazz or Rock standard that everyone knows, as a warm-up... and
giving the candidate an opportunity to explore and stretch.

Blog post at
[http://www.embracingthecloud.com/2012/10/22/EvolutionOfASale...](http://www.embracingthecloud.com/2012/10/22/EvolutionOfASalesforceApexClass.aspx)

------
avmich
Can optionally include this solution - [http://codon.com/programming-with-
nothing](http://codon.com/programming-with-nothing) (at the end).

------
matthewrudy
What this article misses is my favourite bit: maintainability and
extensibility.

If this were real code two things would happen;

1\. Someone would refactor the `fizzbuzz_word(n)` method and this would all
break

2\. Your PM would ask for a new feature "multiples of 7 should be said 'Wuzz'"

So that 2 minute test becomes a 10 minute venture into real world problem
solving.

------
exizt88
I've tried overthinking FizzBuzz myself, but from the architectural point of
view: [https://medium.com/@sbichenko/the-wrong-
fizzbuzz-81cb8e67ef4...](https://medium.com/@sbichenko/the-wrong-
fizzbuzz-81cb8e67ef4a)

~~~
kazagistar
I agree that string concatenation is the optimal solution and always take the
chance to bring out a properly generic solution.

    
    
        let fbg s l u=unlines[case concat[w|(w,c)<-s,mod i c==0]of[]->show i;m->m|i<-[l..u]]
        let fizzbuzz = fbg [("Fizz",3),("Buzz",5)] 1 100
        main = putStrLn fizzbuzz

------
codesuela
im gonna learn the random number seed by heart and put it as an anwser every
time im asked to do fizz buzz from now on

~~~
jacquesm
You're going to be so in for a surprise when the RNG used on the machine
you're showing off your skills on has a different underlying implementation
than the one that you suspect!

------
kragniz
Tangentially related:
[https://github.com/AbstractBeliefs/BadBuzz](https://github.com/AbstractBeliefs/BadBuzz)

A collection of terrible fizzbuzz solutions.

------
OscarCunningham
I like the fact that the information theory adds up. To specify 30 bits he
used a 26 bit number and then specified one of 24 permutaions, and this is
just right because

26 + log(24) = 26 + 4.58... > 30

~~~
thomasahle
Even if the number he specifies has leading zeroes, it's still one out of the
set of 32 bit numbers.

~~~
OscarCunningham
Having leading zeros does make the length of the source code itself smaller
though.

------
emson
Great article thanks. I recently launched the elixirgolf.com web site and
there were some really interesting FizzBuzz solutions. Mine used Fermat's
little theorem

[http://elixirgolf.com/articles/elixir-fizzbuzz-
golf/](http://elixirgolf.com/articles/elixir-fizzbuzz-golf/)

------
ggurgone
A girl on irc once asked if there is a way to solve FizzBuzz with just one
comparison. Yours is indeed one and it is pretty clever :) Here is another one
[https://gist.github.com/giuseppeg/5939177](https://gist.github.com/giuseppeg/5939177)

~~~
cronin101
FizzBuzz from 1 to N (supplied as command-line argument) and exiting
gracefully without using loops, conditionals, or segfaults - in C:

    
    
        #include <stdio.h>
        #include <stdlib.h>
        
        int i(const int i) { printf("%d\n", i); return i; }
        int f(const int i) { printf("Fizz\n"); return i; }
        int b(const int i) { printf("Buzz\n"); return i; }
        int fb(const int i) { printf("FizzBuzz\n"); return i; }
        int (* PC[15])(int i) = { i,i,f,i,b,f,i,i,f,b,i,f,i,i,fb }; // Printer Cycle
        
        int go(const int arg) {
            return PC[(arg - 1) % 15](arg) + 1;
        }
        
        int stop(const int arg) {
            PC[(arg - 1) % 15](arg);
            exit(0);
        }
        
        int (* LC[2]) (int index) = { go, stop }; // Logic Cycle
        
        void recurse(const int i, const int kill_num) {
            recurse(LC[!(i % kill_num)](i), kill_num);
        }
        
        int main(const int argc, const char *argv[]) {
            recurse(1, atoi(argv[1]));
        }

~~~
adrae5df
So at what input value does it overflow the stack on your machine?

~~~
jacquesm
261876 here.

'0' and no number input also crash it.

~~~
adrae5df
Believe it or not its a weird palindrome for me: 65059

~~~
jacquesm
First I thought 'that's a palindrome?', then I saw what you meant. Is it
repeatable?

------
gambiting
Ok, now we need a ridiculously simple version in C, that will probably fit in
64 characters and require a page of explanation :-)

------
desireco42
This is awesome. And funny. I can imagine how this would piss off people
interviewing you who think they are smart.

I think I will use it.

