Makers Day 5

Arrange, Act, Assert — a simple process to putting together a test. First you arrange any pre-conditions you need for the test. A simple example would be creating a new instance of the class that you want to test. Then you call an action upon this. This means using the instance you have created with the snippet of code that you want to test. This might mean providing it with an arbitrary argument for the sake of the test. This step might not even be necessary if you are just looking to see what an instance of a class can do, e.g. “responds to”. Finally, assert. A declaration of what you are expecting to see when that piece of code has been run, or perhaps even what another piece of code does now that you have ‘actioned’ the instance you created. If you have thrown in the arbitrary argument, then what should this result in? If you have told your library to provide you with the title of the third chapter in Harry Potter and the Prisoner of Azkaban, has the program produced the result “Diagon Alley”? If it hasn’t, is this because you haven’t provided this information to the program yet? Try, fail, write test, fail, write code, pass. Rinse and repeat.

Had a very good pairing session this afternoon with Rorie. He was further ahead than me in the Boris Bike challenge so we needed to start back where I had got to. For a second I felt guilty about this, but then he described his other sessions as being fast paced and I felt less bad as this would probably be a good opportunity for him to consolidate his learning by walking me through the exercises. Then I was worried that I might get spoon fed, but again this didn’t turn out to be the case. Rorie and I began by building a solid rapport with each other by sharing what we had struggled with and the fact that we both play the guitar. After this, I worked my way through the exercise with Rorie simply guiding, rather than giving answers, which really aided my independent learning.

We also came up with a good analogy of Makers so far. It’s like every topic is a roll-a-coin collection box. You start by putting your money into a subject, and the coin begins in big circles as you look at the bigger picture of the subject and what it’s about. Then the coin picks up speed as you gain more and more insight into the subject and how it works syntactically. Eventually, the coin reaches the bottom and spins super fast — as we all know it could fall through at any time. Sometimes you can be here for a while, getting frustrated and going around in circles with a topic. Sometimes you’re here for less than a while. At last, the penny drops, and something makes sense! This happened to me with the Arrange, Act and Assert description from earlier.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store