Monday 12 September 2016

Introducing testers to basic programming conventions

I recently ran a 'introduction to programming conventions' workshop with our test analysts.
It was really well received, so I thought it would be worth sharing it in case anyone would like to reuse or copy it.
You can find it in my recent blog post 'Robozzle'

Here's how it came about...

One of our test practices central themes this year is 'Grow the technical tester'.
We're aiming to build out our test analysts technical capability around reading, writing and understanding code, as well as understanding the systems and infrastructure our products run on.

I strongly believe there are some advantages to having a stronger technical base when you're working as a test analyst.
Whether it gives you a partial Rosetta stone to bridge the gap between technical terminology, or it gives you confidence to question implementation talking to the people writing or building your product - a technical understanding of your product used wisely will enhance your test approach.

As part of our internal training workshops and sessions, I wanted a light weight training exercise to kick start this technical growth.
Our test analysts have varied backgrounds in their exposure to programming, some have very limited or no exposure to programming.
I needed something friendly and in a language anyone could pick up.

There are some great courses our there which teach programming. We use PluralSight in house at Trade Me, and I've been through course on Code Academy. I also came across Code Avengers, which is an awesome resource aimed at schools to teach programming - I learnt a lot from some of their courses, so it's not just for kids!
These are great, but it was hard to find something that could be run in the group learning and workshop format I was after for our internal training session.

While researching courses one of our team leads told me about an iPhone game he was using to 'learn coding' called Robozzle.
Robozzle is a programming game where you give a robot a set of instructions to solve a puzzle. It can be pretty addictive...
There are simple tutorials, and then a large number of community created puzzles in varying degrees of difficulty. To solve the puzzles you have to assemble instructions for your robot to collect stars in a maze. utilize things like
I spent a couple of commutes playing the game, with good satisfaction when I cracked a puzzle, as well as good frustration when I spent upwards of 30 mins trying to solve one.

Robozzle ticked the boxes for what I wanted for a workshop
  • show that programming is a set of instructions
  • introduce basic programming conventions
  • be friendly and not scary to people who've never written code
  • be suitable for a group workshop 
So, I threw a draft together
I picked a handful of puzzles which showed the basic concepts within Robozzle; loops, subroutines, and conditional logic.
I added in an exercise on psuedo code to illustrate that the solutions were a set of instructions, and that that programming is writing instructions for computers to execute.
After I had this draft fleshed out, I socialised it with one of our team leads who's not got a strong programming back ground. He thought it would be a fun hour for people to go through, even if no learning took place.

So, we ran it with groups of 10 - 14 people in our training suite (room full of PCs), in one hour sessions.

What I saw and learnt in the sessions

  • People got psuedo code way faster than I expected them to, it wasn't that big a leap for people to get their heads around the concept. It proved to be really good for debugging solutions when people got stuck, and it reaffirmed that programming is just giving something a set of instructions.
  • Different people had different solutions to the puzzles. Most of the puzzles have more than one way of solving them, but at least two groups came up with solutions that stumped the facilitator (me).
  • The people with programming experience weren't the first to complete the solutions. I was worried that people with programming experience would be bored, or see it as a waste of time. But, at the end of the hour all groups in all sessions were still working.
  • People were keen to take the exercise back to their desks. I was walking to get a cup of tea this morning and spotted someone working on harder puzzles than were in the workshop. It was cool to see people still giving it a go five days after doing the session.
  • Some people resorted to writing out the psuedo code on paper for each puzzle, and stepping away from the computer.
  • People really liked the puzzle / game aspect of the workshop. They switched in to competition mode, trying to complete the games before others did. It was all in good fun, and added a nice energy to the room.
Overall, I'm really happy with how the exercise went.
The engagement was great, and people definitely walked away keen to get in to more programming training.

Robozzle

Welcome to a short exercise designed to teach you some basic programming concepts.
The point of the exercise is to show you how program code can be seen as a set of instructions, and show you some conventions like; loops, conditional logic, and subroutines
To do this we're going to use 'Robozzle'. It's a free web based programming game where you give a robot a set of instructions.
All up the exercise should take about 1-1.5 hrs.

Here's what to do...

Get set up

Grab a PC or phone (Android or iOS apps are available. Search 'Robozzle')
Pair up with someone.
Work through the puzzles in order, and utilise pair programming (one person use the mouse and keyboard, the other person talk - and then swap).
If you get stuck, feel free to ask for help!


Part 1: Introduction to Robozzle

  1. Tutorials
    1. Tutorial 1
    2. Tutorial 2
    3. Tutorial 3
    4. Tutorial 4
  2. Basic loop
    1. Stairs
      (make sure you keep this open once you solve it, you'll need it on the next page)

Part 2: Introduction to Psuedo Code

Psuedo Code is a notation resembling a simplified programming language, used in program design.
We're going to write some basic psuedo code to illustrate the instructions which we're giving the robot.

Log on to Trello
Visit our 'Robozle Psuedo Code (master)' trello board

This has been prepopulated with some psuedo-code statements
In the right hand menu in trello, choose '... More', then 'Copy Board' - this will make a copy of the board on your trello account.
  1. Using the statements; translate the solution you had for 'Stairs' (above) in to a psuedo code stack. 
  2. Move on to the Iteration Puzzle
    1. Using the board from above, build your solution with psuedo code FIRST
    2. Then, translate it in to Robozzle instructions. 
Question: What psuedo code instructions are missing? 

Extension if you're feeling up to itVisit our ''Robozle Psuedo Code (master)' trello board
This has been prepopulated with some more code-centric psuedo-code statements
In the right hand menu in trello, choose '... More', then 'Copy Board' - this will make a copy of the board on your trello account.


Part 3: More puzzles

Work through these puzzles.
If you get stuck, look at the Robozzle instructions like they're psuedo code. Walk through what you're telling the robot to do, and see where it might be going wrong.
  1. Nested subroutines
    1. Simple spiral
    2. Function calls
  2. Conditionals
    1. "First puzzle"
    2. "Very easy"
    3. "Don't fail"
  3. Conditional subroutine
    1. "Right on red"

Conclusion

You should have an understanding of program code as a set of instructions which is executed, and understand how things like loops, subroutines, and conditionals can be used to enhance instructions to increase efficiency, and expand logic.
Robozzle is a free to use game that you can play with in your spare time.
As well as web app versions, there are native apps for androis and iOS