Coding is not something I am naturally good at. My worst grade in college was in CS 60. Even after two college CS courses and this tutorial now, I still struggle with it. I understand the high-level concepts just fine—my code just doesn't work. Everything that can go wrong, does—the usual crop of syntax errors, conceptual mistakes, bizarre bugs that even the CS grader-tutors can't figure out so you end up having to turn in a broken program for half or no credit. If you read Girl Genius, when it comes to programming I feel like Agatha back when her spark's artificially crippled.
It's a weird experience for me because I've had little difficulty with virtually any other mode of self-expression. I can draw, paint, sculpt, sing, play piano, speak, and write reasonably competently. It's frustrating to have ideas for web apps in my head and no way to make them real.
At the same time, from a practical standpoint I like working with computer geeks and mastering code seems like a good way to be able to do that. Basic programming knowledge, specifically in Python, is also a requirement of the iSchool master's program I plan to attend next fall.
So that's what's been motivating me to continue hitting my head against this wall.
Anyway, by way of encouragement, a friend pointed me toward this Jeff Atwood post, as well as its update three years later, about how unbelievably many people—many of them CS majors!—apply to programming jobs but don't know the basics of coding, at all. Thus, many employers have resorted to requiring applicants to solve simple coding programs over the phone or online before they get to the interview stage in order to avoid wasting everyone's time. One such easy problem is the FizzBuzz test:
After a fair bit of trial and error I've discovered that people who struggle to code don't just struggle on big problems, or even smallish problems (i.e. write a implementation of a linked list). They struggle with tiny problems.So I set out to develop questions that can identify this kind of developer and came up with a class of questions I call "FizzBuzz Questions" named after a game children often play (or are made to play) in schools in the UK. An example of a Fizz-Buzz question is the following:
Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".
Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes. Want to know something scary? The majority of comp sci graduates can't. I've also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.
Sadly (?), even I can solve this one. Does that mean I qualify as a programmer? :P
My solution after the cut.
for i in range(1, 101):
blah = ''
if i%3 == 0:
blah = blah + 'Fizz'
if i%5 == 0:
blah = blah + 'Buzz'
if blah == '':
blah = blah + str(i)
(sorry for the extra spaces, I couldn't get it to reflect the indents properly otherwise)