Fizzbuzz, Interviews, And Overthinking
dave.fayr.am
Fizzbuzz, Interviews, And Overthinking
1–10 of 115 posts
Re: Fizzbuzz, Interviews, And Overthinking
#2Re: Fizzbuzz, Interviews, And Overthinking
#3Re: Fizzbuzz, Interviews, And Overthinking
#4I think in talking about programming, we are often hindered by the fact that it is much more complicated than our brains can handle. Our only choices are to write novel length treatments of real programs or short story length posts about a toy program, or just the tiniest piece of a real program.
Which is all to say, as sick of hearing about Fizzbuzz as I am, I'm glad there are silly little examples like it that we all know. Even though it was ostensibly about interviewing, that was a much clearer introduction to monoids than most. I think it was largely because it was in reference to Fizzbuzz: something very concrete with which we're all familiar.
Too many introductions to Haskell's abstractions are too abstract. Good on the author for finding away around that.
Re: Fizzbuzz, Interviews, And Overthinking
#5Forget Fizzbuzz, we get candidates that cannot reverse a string (in their language of choice). A friend of mine just told me he uses the question "What is the hex number that comes after 'F'" as his first "weed-out" technical question. It boggles the mind.
Re: Fizzbuzz, Interviews, And Overthinking
#6 for i in xrange(1,101): print (('' if i%3 else 'Fizz')+('' if i%5 else 'Buzz')) or i
or the even more general: mapping={3:'Fizz',5:'Buzz'}
for i in xrange(1,101):
print ''.join(['' if i%x else mapping[x] for x in mapping]) or i
We can even do this in C though to write something as extensible as the second would require writing more helper functions than I can justify for this brief comment: #include
#include
int main(){
int i;
char s[4];
char n[3];
for (i=1;iRe: Fizzbuzz, Interviews, And Overthinking
#7I agree that Fizzbuzz can be a more interesting example of how to write code without repetition. While the author suggests that languages such as Haskell provide a unique advantage, the deciding question seems to be the availability of pre-built abstractions. Consider the following solution in Python: for i in xrange(1,101): print (('' if i%3 else 'Fizz')+('' if i%5 else 'Buzz')) or i or the even more general: mappin…
Re: Fizzbuzz, Interviews, And Overthinking
#8I understood from near the very beginning that this wasn't really about Fizzbuzz. All the way through the post, I was waiting for the author to get a real world example instead of Fizzbuzz. Yet, I got to the end of the post and realized it was already pretty long. I think in talking about programming, we are often hindered by the fact that it is much more complicated than our brains can handle. Our only choices are t…
What sort of surprised me as I shopped my copy around and showed people the python-add-one-factor example is that even programmers I consider experts didn't realize how quickly the conditional cascade blows up. It's easy to miss. And I looked around for people to mention this in blog posts, but almost no one does. So I feel like there's a bit of life left in the old fizzbuzz yet.
Re: Fizzbuzz, Interviews, And Overthinking
#9I agree that Fizzbuzz can be a more interesting example of how to write code without repetition. While the author suggests that languages such as Haskell provide a unique advantage, the deciding question seems to be the availability of pre-built abstractions. Consider the following solution in Python: for i in xrange(1,101): print (('' if i%3 else 'Fizz')+('' if i%5 else 'Buzz')) or i or the even more general: mappin…
('' or 10) == 10 # True
That's like making the universe crazier one electron at a time.But yes, it's just about having the right abstractions. What's nice about the Haskell solution is that the right abstractions make the code much nicer (to my eye).
Re: Fizzbuzz, Interviews, And Overthinking
#10In this week's installment, the variation where it is claimed that common production languages are inadequate for a problem of this complexity, and the tool stack should be shifted to languages supporting monads... er monoids? Sigh.