Live data from Hacker News

Fizzbuzz, Interviews, And Overthinking

dave.fayr.am

81–90 of 115 posts

Re: Fizzbuzz, Interviews, And Overthinking

#81
First of all a modulo is ultra expensive, one does not simply modulo 15 when they already modulo 3 and 5.

The proper structure is if(3){if(5)}elif(5){}else{},unless anyone has a better proposition. While of course it is possible to define abstractions that handle fizzbuzzing anything for any number, it's clear that the monoid way is a bad overweight bloated approach.

Second the example written is code bloat à la java, writing tons of stuff for no reason.

Third Ruby is a beta prototype language that doesn't have any production ready implementation.

Lastly functional and procedural programming enable you to work at the highest level of abstraction you can think of, whereas OO tends to lock you at a specific abstraction level, which is pretty low and not adapted to most cases.

I have to admit it's impressive how such a simple test can show so many failures in people's deep understanding of programming.

Re: Fizzbuzz, Interviews, And Overthinking

#83
post #59

Earlier quoted context omitted.

Just for fun, another variant - separating logic from data and trying to be pretty stock python. cases = [(3, "Fizz"), (5, "Buzz"), (7, "Bazz")] for i in range(110): pr = ''.join([v[1] * (i % v[0] == 0) for v in cases]) print pr or i

It should be possible in a single line of Python.. pip install fizzbuzz And then: import fizzbuzz print fizzbuzz.fizzbuzz() Or for the second solution: print fizzbuzz.fizzbuzzbazz()

A tweetable (140 character) single line of Python:

print '\n'.join((lambda x:(''.join(x) if x else str(i)))([w+'zz' for (n,w) in ((3,'Fi'),(5,'Bu'),(7,'Ba')) if i%n==0]) for i in range(1,100))

Re: Fizzbuzz, Interviews, And Overthinking

#85
post #80
post #43

Earlier quoted context omitted.

If you cannot reverse a string under pressure, you are likely unqualified for the job you are applying for. At least in my job, there is often more pressure than "write a string reverse function in any language you like in 10 minutes."

What a load of bollocks. If your job is to write methods to reverse strings then you are unqualified, otherwise I wouldn't give a shit whether a candidate can reverse a string. Why would I want to know if someone can reverse a string if the job is to maintain a web app? A few questions for you. How old are you? Have you hired developers before? Truthfully, have you ever had to reverse a string under pressure at your…

Are you kidding? reversing a string in your language of choice is far too trivial. If you can't do it you really aren't ready to be working in the industry.

Re: Fizzbuzz, Interviews, And Overthinking

#86
post #41

Earlier quoted context omitted.

They cannot reverse a string even using the API call? If so are these people who have held down a programming job before?

I assume the question is something along the lines of "Implement a strrev in the language of your choice" , not "Use the strrev equivalent in the language of your choice" .

Even with this addendum, there is a grey zone:

    reversed_string = string[::-1]
Is it just using the equivalent, or a new implementation?

Re: Fizzbuzz, Interviews, And Overthinking

#87
post #85
post #80

Earlier quoted context omitted.

What a load of bollocks. If your job is to write methods to reverse strings then you are unqualified, otherwise I wouldn't give a shit whether a candidate can reverse a string. Why would I want to know if someone can reverse a string if the job is to maintain a web app? A few questions for you. How old are you? Have you hired developers before? Truthfully, have you ever had to reverse a string under pressure at your…

Are you kidding? reversing a string in your language of choice is far too trivial. If you can't do it you really aren't ready to be working in the industry.

Out of curiosity, when the interviewer asks you to reverse a string in your language, say Ruby, are you supposed to use existing algorithms/methods built-in in that language, or to flip each character using a for-loop? In Ruby, it's really a single method called reverse will do the trick, i.e., "hello".reverse gives "olleh". I'm trying to make sense of the reason why such a question is asked.

Re: Fizzbuzz, Interviews, And Overthinking

#88
post #85
post #80

Earlier quoted context omitted.

What a load of bollocks. If your job is to write methods to reverse strings then you are unqualified, otherwise I wouldn't give a shit whether a candidate can reverse a string. Why would I want to know if someone can reverse a string if the job is to maintain a web app? A few questions for you. How old are you? Have you hired developers before? Truthfully, have you ever had to reverse a string under pressure at your…

Are you kidding? reversing a string in your language of choice is far too trivial. If you can't do it you really aren't ready to be working in the industry.

It's not about whether they can do it or not. It's about why knowing a skill that will take even a non-developer ten seconds to Google makes someone incapable of functioning as a developer.

More often than not the people that spout that kind of nonsense are twenty-something junior developers that read a bit of HN and have decided that they know better than everyone else about what makes a good programmer.

Why would you test if someone can reverse a string if you're hiring someone to maintain and build on some shitty web app?

Re: Fizzbuzz, Interviews, And Overthinking

#89

I 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…

In the Python example, wouldn't you need to make sure the x values from mapping are sorted, since dictionaries are unordered? Change, for x in mapping to for x in sorted(mapping)

Re: Fizzbuzz, Interviews, And Overthinking

#90
post #88
post #85

Earlier quoted context omitted.

Are you kidding? reversing a string in your language of choice is far too trivial. If you can't do it you really aren't ready to be working in the industry.

It's not about whether they can do it or not. It's about why knowing a skill that will take even a non-developer ten seconds to Google makes someone incapable of functioning as a developer. More often than not the people that spout that kind of nonsense are twenty-something junior developers that read a bit of HN and have decided that they know better than everyone else about what makes a good programmer. Why would y…

It takes someone who doesn't speak English ten seconds to look up the past tense of the verb "bring" - this doesn't mean you'd want to hire as a journalist someone who seems to think the answer is "bringed"

Doing a string reverse is so trivial that it's not about needing that skill, but rather what not being able to do that speaks about the candidate's general aptitude and skill level.

Post reply on HN