rossharper.net

Can you TDD in Scratch? Yes, you can!

Can you TDD in Scratch?

TL;DR: yes, you can!

Overview

In our team, we use a Test-Driven Development (TDD) approach when writing code. I’m a supporter of this approach and its many benefits. I won’t go into the benefits here — you can Google many articles on the subject (other search providers are available).

Scratch, from MIT, is essentially a visual programming environment that “helps young people learn to think creatively, reason systematically, and work collaboratively — essential skills for life in the 21st century”. There’s a growing movement around teaching kids to code, that will hopefully play an important part in solving the skills and diversity shortages our industry has.

One day, the crazy thought popped into my head: “Can you TDD in Scratch?”. I did a brief Google, and couldn’t find any examples of TDD in Scratch.

So, in my “10% time”, I looked into doing some TDD in Scratch. For my first experiment, I implemented the algorithm for the Roman Numerals Kata. I cheated a little here, by implementing the algorithm first and then put a test around it afterward (this isn’t TDD!).

Scratch running the Roman Numerals Kata

This at least proved that it is possible to separate my algorithm logic and have tests around it. So next I decided to do some actual TDD in Scratch…

Read the full post in the GitHub readme: https://github.com/rossharper/ScratchTDD/blob/master/README.md


Parameterized JUnit4 Unit Tests in Kotlin

(Jump to the TL;DR of how to create a Parameterized JUnit4 test in Kotlin)

This weekend I’ve been learning a little Kotlin — the (relatively) new JVM language from JetBrains. Once I’d worked my through the “Koans”, I decided to try a simple Code Kata. I chose the Roman Numerals Kata for this exercise. Whilst doing this, I wanted to use a parameterised unit test, and had to figure out how to do that in Kotlin…

Read More →


Decoding a Siemens RCR10/433 Thermostat Signal to Control a Boiler from a Raspberry Pi

This is a quick post in response to a question related to my boiler control Github project: https://github.com/rossharper/boilercontrol I intend to eventually perform a more comprehensive write-up of this whole project.

Background

I had been looking to start tinkering with my Raspberry Pi and do some home automation for a while. We have a Siemens RCR10/433 wireless thermostat programmer that controls our boiler and I wondered if it would be possible to hack the radio signal and take control of the boiler myself. Thus, I could create my own smart heating system inspired by products such as Nest and Hive. This post roughly outlines the process I used to sniff the signals sent between the thermostat and the receiver relay that controls the physical call for heat signal to the boiler.

Read More →


Glentress – Mountain Biking

Looking out over Glentress Forest

Easter weekend saw Liam and I head up to the Tweed Valley in Scotland for a couple of days mountain biking. Our base was the campsite at Glentress Forest Park, where we camped with my tent and “the van”. It was to turn out to be a fantastically enjoyable weekend of trail-riding in glorious sunshine (the locals informed us we were very lucky to have such weather!).

Read More →


Dovestone Edge in the snow

Dovestone Edge Panorama

Dovestone and Yeoman Hey reservoirs taken from Dovestone Edge in the Peak District.

Last April, a friend and I went for a walk around Dovestone Edge in the Peak District and were greeted by a blanket of snow on some of the hills. Below is the view from the opposite side of the reservoir basin, from Alderman’s Brow. A blanket of fog was just lifting as we arrived at this rocky outcrop, revealing the view.

Alderman's Brow

Read More →