Last week was the second week of my time at Makers Academy. After an intensive first week, the pace continued, with the routine being established of Monday focused on Code Reviews of our end of week challenge, then Tuesday to Thursday undertaking a project whilst receiving lectures on relevant topics, and on Friday receiving our end of week challenge.
Our challenge during the week was to build a Battleships game in Ruby, to focus us on Object Oriented Design and Test Driven Development. As with last week’s challenge we worked in pairs. My pair this week was Josh (who is also writing his own blog).
What I’ve Learnt About Coding
Test Driven Development (TDD)
I hear a lot of mixed views on this. I admit that sometimes it’s frustrating when you just want to get stuck into writing code, but I do appreciate the focus it gives you on developing only what you need and I’m very glad that Makers reinforce this through all the teaching.
One key learning I’ve had on TDD has been to keep the scope of the test within the class you’re focused on. This is along the lines of SOLID principles. I can see that writing good tests is as important as writing good code. I’m getting the hang of mocks / doubles and stubbing, but practice is the key.
Less Is More
When writing our Battleships programme, by the end of the first day, Josh and I had created a large number of lines of code (LOC), in solving some key aspects of the game, such as enabling players to place their ships, ensuring they don’t get placed on other ships or go outside the grid. Our tests worked and we were pretty pleased with ourselves.
On the second day, we made more progress with the game but reduced our lines of code. We refactored many elements to achieve the same results with less code and improved readability.
Our lesson here is Red => Green => Refactor, i.e. write your tests, pass your tests, then look to improve it.
This was true of our end of week challenge – writing a method that would replicate how the inject method works in Ruby. Once my tests were green I had around 40 lines of code. But through spotting repetition and finding some other improvements I got this down to around 10. Very satisfying.
Domain Design Is As Hard as Coding
If not harder. If you get stuck on a coding issue Google is a ready helper. Unfortunately Google is less helpful with your domain model – what and how many classes do I need? Which object needs to do what? I think this is something that will get clearer with practice. I’ve noticed I have a tendency to overcomplicate my paper design and end up being more flexible when I come to coding. Something for me to keep an eye on.
What I’ve Learnt About Learning
I’m really enjoying learning and can feel my brain working in a way that it hadn’t for a while whilst in a career job. At Makers they record each lecture and make it available for playback, something I’ve used a couple of times. It’s difficult to take everything in when you’ve got a combination of watching code and listening to the explanation, whilst trying to make notes, so these videos are a really useful resource.
At the start of week 2, Makers moved from their City Road premises to Commercial Street. A multi-level office this time with lectures on the first level, then workspace above and a “staff room” mezzanine. Very start-up look to it with exposed brick and wooden floors. In a great location, with Brick Lane to the East, the City to the West, Spitalfields to the North and the Tower of London to the South.
We know have 2 weeks off for the Christmas break. An opportunity to relax (a bit), reflect and keep on coding and reading up (I have a long list of things to do). I do find that at this stage I need to be coding regularly to keep the learnings in my head, so I’ll be making sure my GitHub streak continues throughout the break.
Also Friday night saw the Christmas Party / Office Warming. One reason why I’m doing this course is because I’m interested in opportunities in start-ups where I can bring a mix of my commercial skills, eCommerce management and following this course, some technical know how. So it was great on Friday night to get talking to Les, one of the founders of BorrowMyDoggy.com and hear about his experiences in starting and developing that business.