Coding

Testing the happy path – Coding Tips

Imagine you are coding a game where the player needs to pick up the red key, so they can open the red door.

When the code is ready, you’ll want to test it. You might try picking up the red key, then go to the red door and see if it opens. It does! Yay, it’s working – or is it?

When you test everything going right, this is called testing the happy path. But it’s also important to test the other paths. For example:

  • What if you try to open the door, but without the key? The door should stay closed.
  • What if you try to walk through the door when it is closed? You should not get past.
  • What if you pick up the blue key, and try to open the red door? It should not open.

Those are ideas for a game. On a website, there are also different paths to test:

  • What if someone tries to log in, but their password is wrong?
  • What if someone bids on TradeMe, but someone else already made a higher bid?
  • What if someone clicks ‘Send’ on an email, but they forgot to say who the email was to?

It’s really important that the program knows what to do when unexpected things happen. To be a great software tester, you need to think about all the possibilities – not just the happy path!

Remixing in Scratch

There are 11 million projects on the Scratch website! Some of them are really good. If you ever find a project you like, you can look inside to see how the author made it.

Once you’re inside, you can also change around the project and save it as a remix – adding your own ideas to the project.

One of my favourite Scratch games is Level 1 by Maki-Tak ( https://scratch.mit.edu/projects/1241509/ ). This is a platform game with one level. When you get to the end, a message comes up inviting you to create a remix where you add your own Level 2.

scratch 3.png

Lots of people have remixed the game. In fact, there are 86 different versions. Scratch can show you a remix tree of all the different versions.

The base of the tree is the original game. Each branch leads to a remix. For this game, you can see that some of the remixes have their own remixes, and there are chains so long they go off the screen!

It’s fun to create your own projects, but it can also be great to start with someone else’s project so you have to make everything yourself. Are there any Scratch projects you would like to remix?