Programming for non-programmers

I was fortunate enough to run an unconference at my company's recent offsite titled "programming for non-programmers". When deciding what tasks and challenges we could do as a group I settled on fizzbuzz. Fizzbuzz is a fairly simple programming challenge often presented to junior engineers. I will paste my solution below and then dive into why I think this is the perfect fit for non-programmers to get involved.

for fizzbuzz in range(51):
    if fizzbuzz % 3 == 0 and fizzbuzz % 5 == 0:
        print("fizzbuzz")
        continue
    elif fizzbuzz % 3 == 0:
        print("fizz")
        continue
    elif fizzbuzz % 5 == 0:
        print("buzz")
        continue
    print(fizzbuzz)

The seemingly simple code covers a number of new subjects for the non-programmer:

The end result of being guided through all of this means that the non-programmer can produce a small chunk of code that is normally used in junior interviews.

When discussing with the non-programmer it is important to first show the outcome of fizzbuzz: 1 2 fizz 4 buzz fizz 7 8 fizz buzz 11 fizz 13 14 fizzbuzz ...
From here a discussion can be lead with "what is happening here?", "if we were to do the same with a deck of cards, what would we do?".

The important part is deciding as a group what the order of operations should be, what the code is "deciding" to do and what that would look like as an ordered list of decisions rather than the actual code. Non-programmers shouldn't be too worried about the syntax of code but more concerned about setting up the logic gates around the problem.

Before even touching the code a list can be drawn up as so:

  1. create a list of 1-50
  2. go through each number of the list
  3. check if it is divisible by 3 and 5
  4. check if it is divisible by 3
  5. check if it is divisible by 5
  6. if none of the other rules are true then print the number

Getting started with code is infinitely easier than people think and we, as engineers, should be working to reduce these barriers for entry wherever possible. Showing how simple it would be to pass the first technical challenge in an interview is just the first step in this process

back