Second week at Makers Academy and again a storm force onset of new idea and concepts. First more Ruby, building rapidly on what we had started last week. One of the new topics this week was blocks. Not something I had encountered before, the amazingly useful structures allow you to do magical transformations on arrays using such methods as map, each and select. To try and explain blocks to myself I have tried recreating their implementation. Check out my github repo to see more. I will try to extend both the explanation and examples here over the next few weeks.
Blocks were ok, Regular expressions are something all together harder for my mind to fathom. These small snippets of characters are too represent strings. A first the seam incomprehensible and after a day the situation hadn’t much change, Their use is to match snippets from text. (Thinking of pulling all the email addresses of a webpage this is how). As exotic as they seam used properly the are able to achieve far more than I feel should be possible with so little. My favorite website from this week is Rubular which allows you to experiment with regular expressions.
Far more interesting this week was the concepts of pair programming and test driven development (TDD). Which together make the spooky interaction.
Pair programming does exactly what it says on the tin with two people working on the same code. They key here is not to divide the work between two people but at each and every line to have two eyes on the code that is being written. There are many reasons for this such as reduced bugs increased readability etc etc.
Test driven development is a methodology to create code with the aim of increasing code quality. For each piece of software you first write a test which must fail, IMPORTANT. Only then do you add code to your actual program that can pass the test. After this comes another test and so on. The interesting point comes from the fact that TDD works best when starting from the absolute basics and working up in small steps. Even experienced developers would always start a new project from the basics and work up.
Using both TDD and pair programming we worked to create a method that would convert roman numerals to numbers. Deciding to start exactly and feeling slightly silly I came up with the simplest test possible:-
Given “I” return 1
well to solve this test and this test only we wrote a method that would return 1. Always. Give it “Moose” it would return 1. But are test wasn’t checking moose to it passed and we moved on. The next test implemented said:-
Given “II” return 2
The solution, simply count letters and return that value. The two test pass BUT give it egg and it returns 3 and Hippopotamus gives you 12. Well feeling like this was all perhaps a bit pointless we progressed. Well after 15 or 20 more test we had a solution. I was not surprised it seamed logical it would work. What was impressive was our solution was implemented in only three lines of code much more succinct than either of us had achieved on our own without tests. The oddest realisation was that neither of us felt like we had particularly made the solution happen. we had both just done what we had too to pass tests as simply as possible.
If all that learning was not enough for one week we also had three talks from completely different people. The first was from, Matt Cooke, one of the founders from Unruly Media. A British success story in the tech world. His talk highlighted among other things the number of failures he had had along the way. Also the value of these failures came in being able to quickly change direction and use the skills you had learn in a new area.
Next was Sam on remote pair programming. This talk was the most energetic by far and we were left in no doubt that he was a great enthusiast for pair programming. A big thanks to Sam for introducing me to pair programming by github (git-pong). I have not yet created anything very useful with git-pong but it is a fantastic way to learn github.
The final talk was from Margo a former student at Makers who was at her first week with Mint Digital. Quite a big deal to those in the know, I’ll admit I had never heard of Mint Digital previously. Margo was given the task of inspiring us and say she did. It was obviously that at certain points during Makers she had struggled. It was also clear that she had repeatedly triumphed by slogging them out and now had a job she enjoyed.