3 ms·
I like the large-company version with baroque OO/Java appendages hanging off of everything. Those flourishes make it feel safer and more reassuring, I guess. T
by mtdewcmu 13y ago
I like the large-company version with baroque OO/Java appendages hanging off of everything. Those flourishes make it feel safer and more reassuring, I guess.
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.
- prateekj 13y agoAlthough the large-company version looks overwhelming to an onlooker, it actually starts from a simple version and then keeps growing as more bugs and compatibility issues are reported. Hilarious though!
- mtdewcmu 13y agoPossibly. OO theory and Java (I don't really distinguish the two) actively encourage creating lots of classes to do simple things. I think a lot of people would look at that style and nod approvingly at the use of design patterns and correct use of OO idioms. They wouldn't see much wrong with it. OO theory also promotes good, commonsense ideas, like limiting the number of classes and the limiting the complexity of the interactions among them. But they contradict themselves, because lots of classes and complex designs are the inevitable consequence of the style they preach. 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.