The Six Most Common Species Of Code
willa.me
willa.me
The math PhD one seemed possibly unfair. It looked more like something that would come from a CS PhD who did his thesis in PL.
It's hard to judge what the right solution would look like. You could go many careers without ever having a real reason to write that function outside of an interview. Fibonacci numbers occasionally come about as a by-product of doing something interesting and useful; in cases where they would be interesting in and of themselves, you would probably be using a library or language, like Mathematica, that would have that built-in.
Objects can be considered a bad idea on their face, because they are made up of code wrapped tightly around state variables that are supposed to be secret and hidden. The functional style preaches the exact opposite: functions should not have side effects; all their state is either passed-in or returned. The more state your program keeps, and the greater the number of types of transitions that are possible, the greater the number of ways that the overall state can become inconsistent and cause an error. The way to keep the problem in check is to try to make state and state transitions simple and clear. I'm not a functional absolutist -- I don't use functional languages very often, and I see nothing wrong with doing simple things in the most natural style and language -- but I think the point is valid about how to deal with state.
Killed it. This is hilarious.