Working inside the box
Day two begins. everyone slowly trickles in and we start our first lecture at 9:30. The lecture covers a lot of what my pair and I had attempted to do yesterday evening so it helps to consolidate and clarify what we had been doing. This is great because it means that when we are told to get back together to start coding again, we both have ideas on how to make our programme work differently that we are eager to implement.
But it doesn’t always quite work out how we imagine it to in our heads.
Failing test, after failing test, after failing test
One of the things that Makers Academy very strongly pushes in their teaching style is TDD – Test Driven Development. This means that every time you want to write some code for your programme, you must follow a series of steps;
- Figure out what it is you want it to do
- Write a ‘test’ that will ‘check’ if your code is doing the correct thing
- Run the test
- Watch it fail
- Only now can you start to write the code for the programme. Write what you think it should look like.
- Run the test again
- Watch it fail again
- Repeat steps 5 – 7 again. And then again. And then again. Keep doing this until you want to punch the computer, then take a deep breath, and ask for some help.
Ok, well number 8 might be a bit exaggerated. And sometimes, if you were lucky, you never got to number 7 anyway. But occasionally number 8 would rear its ugly head and we couldn’t do anything to get out of this vicious cycle. It felt like we were going around and around in circles.
The Twenty Minute Mark
During the first day one of the coaches had told us that when we hit a block in the code where we cannot figure out what is wrong, we should not work on it for longer than 20 minutes. This seems logical. After 20 minutes of staring at something and making no impact, it’s time to give up.
I think we probably dragged our first code block slightly longer than this 20 minute mark because we kept thinking that the fix should be easy. The error that the tests kept throwing up seemed so simple that we couldn’t figure out why we couldn’t fix it. So we stubbornly kept on trying.
Eventually, as I went to get my second mug of coffee, we decided to admit defeat and call for help. Luckily we did as not only were there a couple of things that needed changing about our code, but while watching the coach work through and talk us through our code, we learnt an incredible amount. Those few minutes were probably the most informative minutes we’d had so far.
Working inside the box
My pair and I were happily coding away together, working through the instructions we had been given for the week’s project (the Boris Bikes). And then we hit a code block. Another very big one. But this time the coaches weren’t around (they tend to leave at 6 as they need time to prepare the material for the next day etc). We tried everything and couldn’t figure it out. Then a colleague came over for a chat, through which we learnt that we had somehow managed to stray from the instructions. We had taken what now appear to have been rhetorical questions literally and had started coding accordingly. What we were trying to programme was still part of the project, but the order in which we were doing it was causing us to hit this code block. We couldn’t see a way around it other than saving our work, then removing all of the stuff we had done since we had ‘strayed’ off the instructions. This was a bitter moment. I think we had both been quite proud of that code as most of it had worked, and it had mostly been written from scratch.
So we returned to instructions and started to work our way back down them. At least we still have the other code saved so that when we get to those sections we can reintegrate it.
Lessons for the day;
- Sit up straight. Working at a computer for that long is a massive strain on your back.
- Don’t try and get coffee from the coffee machine 5 minutes before the lecture starts, it will definitely be empty.
- Try and stick to the fruit in the kitchen, not the crisps.
- Drinking lots of coffee and lots of water = lots of toilet trips
- Take your shoes off while you’re in the office. Comfort is key.