Daniel natron: thanks for the laugh.
Had I read the FizzBuzz topic right after the original post, I would not have felt âcompelledâ to write a solution.
After seeing many other solutions in various languages, it became a fun thing to add.
Now, off to my hacked Guitar Hero II game, and Stairway!
Or more precisely, itâs the programmerâs /Smoke on the Water/âŚ
Iâm looking for âBladerunnerâ's voice-comp test for programmers
Itâs a âVoight-Kampfâ test.
OK, that was needlessly nitpicky, but I just couldnât stop myself.
@blkmage: How are you ever going to gain experience if you donât try for a job? Thereâs a lot of code to be written out there, and not all of it needs someone who groks programming really deeply. To quote The Magic Schoolbus: ââŚget out there, take chances, get messy and make mistakes!â If youâre anything like me, the way to grok programming more fully is to do it, and if you can get paid for it, so much the better.
@Pete: I think a number of programmers (several on my LJ, at any rate) see obfuscated/ultracompact code as a challenge, and a bit of a status symbol: âI can solve this problem in N statements!â âOh, yeah? I can solve it in N-1 statements!â To some degree, itâs a pissing contest. Looked at from another perspective, though, thereâs a certain joy to be had in being able to solve a problem in as few characters as possible. It likely wonât make any difference in execution speed, but it may save a bit of time and tedium on the part of the coder. And readability really is in the eye of the beholder.
Full Disclosure: Iâm one of those compulsive FizzBuzz solvers.
To Jeffâs astonishment people were actually posting solutions to the simple code test. But really Jeff, when will a programmer not try to flex his might and show off his skills a bit. However, some people where trying to one up each other and the started to post code and forgot to do parts of the test, like print the number everywhere else or print FizzBuzz every 15 lines.
The author stated that a decent programmer should be able to write the code in under two minutes. But itâs one of those tests that is so simply you have a chance not to follow the directions. As a lot of the people who were posting solutions didnât do.
So to me the test is a two-fold question. 1) Can you write a simple program and 2) Can you follow directions?
One more thing - the sort of programmer that reads this blog shouldnât be above implementing FizzBuzz. Far from it - itâs the sort of thing that one should do periodically to make sure one remembers how.
Actually, I thought that there was one interesting point about fizzbuzz itself.
The best solution obviously involves using modular arithmetic. If, by some strange twist of fate, the candidate did not know modular arithmetic, would that be an automatic no-hire?
By ânot knowâ I mean that they donât know that most (all?) computer languages have an operator that gives you the remainder; not that they are completely âmath illiterateâ.
What if they solved the problem using some other method (say, counters or repeated subtraction)?
I found yesterdayâs Fizzbuzz post very encouraging. I am not currently employed as a programmer, but would very much like to be. I could write the Fizzbuzz program without a problem (albeit in BASICâŚ) and it is encouraging that even at my neophyte level, my genuine fascination with code puts me ahead of such a greater percentage of applicants!
Pete on February 28, 2007 04:23 AM
Iâm sorry, but I disagree. I read about half the comments on the last post and didnât see one genuinely good solution to the problem. None contained a single comment, all utilised hard coded constants and most were just plain obfuscated.
That whooshing sound was the joke flying over your head. The main point of fizzbuzz was that it was incredibly easy a caveman could do it and people in here were just having fun.
As for writing comments: this was an interview question. Did you also scream that they put their code in the default package!!1!!
I have a different take on the programmers taking up the challenges of the FizzBuzz problem (at least on tickletuxâs site).
Good programmers are creative, like a challenge and enjoy solving old problems in new, more elegant, ways. The way Iâm reading those posts are thoughts on how to make it more elegant and efficient. And a way to show off different programming paradigms and language strengths.
Big, complex, monster problems are solved by breaking them down into smaller, more manageable problems. Seeing how programmers tackle problems in new ways is what I want to see from my candidates.
Love the Wayneâs World reference, but this is different. Guitarists that play Stairway are trying to play it verbatim and often are not very good at it. However, if you played well enough to put your personality into it and make it yours then thatâs another thing altogether.
This is how you respond when you get a passionate, creative reaction from programmers in response to your post? Thatâs really lame. And Iâm glad no one listened to you.
Seeing idiomatic Python, Ruby, Scheme, Common Lisp, Haskell, SmallTalk etc. solutions is edifying if you donât program in that particular language everyday. Lots of the solutions showed examples of some of the great features in those languages. Look at Raganwaldâs compose carbonation functions if you donât believe me. And Iâm not ashamed that I learned something from reading that.
The truly frightening thing is the large proportion of âsolutionsâ in the comments that are wrong. Bounds errors, logic errors, failure to read the spec errors, holy cow.
Definitely proof that the âaverageâ developer should be doing something else for a living.
Iâd say no - thereâs plenty of other (admittedly sub-optimal) ways to do it. I think the point is that they can come up with something that works. You can always optimize later.
Ugly way to do it (gotta prove I can, yâknow) - VBA, since thatâs what Iâm using at work
Dim number As integer, Dim count3 As integer, Dim count5 As integer
count3 = 0
count5 = 0
For number = 1 To 100
count3 = count3 + 1
count5 = count5 + 1
If (count3 = 3 And count5 = 5) Then
Debug.Print "FizzBuzz"
count3 = 0
count5 = 0
ElseIf (count3 = 3) Then
Debug.Print "Fizz"
count3 = 0
ElseIf (count5 = 5) Then
Debug.Print "Buzz"
count5 = 0
Else
Debug.Print number
End If
Next number
It might have been lost in the noise from yesterday, Jeff, but there are people trying to make Software Engineering a real trade.
For example, The Association of Professional Engineers of British Columbia has a âSoftwareâ designation. Thatâs right - itâs being treated the same as Civil, Mechanical, and Electrical Engineering. You get a degree, you work under other P.Engs for 4 years, then you take a professional practice exam.
http://www.apeg.bc.ca/reg/ProfessionalEngineer.html
Itâs a start.
Thereâs also a planned change to make members of all disciplines take continuing education courses.
Wait a sec. Does that mean youâre lousy if you CAN solve it? Or does it mean your lousy if your not depressed about how lousy all the comp sci grads are? But wait, if I read this blog then all my lousiness is canceled right? Iâm gonna put that on my resume.
The problem I saw was that everyone posted solutions in VBA, Windows SCripting Host, VB etc. How is that any solution? I think maybe the FizzBuzz should also analyze what language coders choose. WSH? VBA? your scaring meâŚ
If the people who spent all that time writing code snippets here yesterday had, instead, written to their local universities/colleges/community colleges and asked them how this could happen, maybe something productive could have come from it.
Programmer, police thyself!
Also, I thought Bradâs comment on the rise of HTML was on the mark. After reading through the a good chunk of those comments yesterday, I was talking with the wife about, essentially, the same thing. When we were taking programming classes back in the 70s, there really wasnât any such thing as a GUI (and certainly no HTML). Your I/O options consisted of âdo you want a card punch machine with or without a working ribbon?â
What it works out to is that we spent almost no time programming UI stuff because the UI was primitive and unimportant: algorithms and data structures were important, UI wasnât.
My son is currently in his 3rd year of a CS degree. His first 2 years were âwastedâ with all the stuff necessary to satisfy the âwell-rounded personâ requirements of the university. The first term of the actual CS degree stuff started with basic programming (FizzBuzz stuff). But, instead of moving on into linked lists and data structures, they spent the next term working on the GUI aspects of programming. Only this term are they back into what we used to consider to be actual programming.
Itâs too late to stop the flood of vitriol that will result from that previous paragraph. But, I do want to say that I understand why the school does that: itâs a GUI world now and that stuff needs to be covered. But, whatâs the cost of that coverage? FizzBuzz failure?
My thoughts on the problem âsorting the sheep from the goatsâ
ryan on February 28, 2007 08:25 AM
The problem I saw was that everyone posted solutions in VBA, Windows SCripting Host, VB etc. How is that any solution? I think maybe the FizzBuzz should also analyze what language coders choose. WSH? VBA? your scaring meâŚ
Real programmers adapt to the workplace to a certain extent, and are comfortable working with languages that arenât necessarily their ultimate favorite, in order to Get The Job Done â˘.
You cannot always just parade into a job and say âright, toss that lot and lets start over with xyz languageâ.