Hi. I’m Max Woolf .

Here are some thoughts of mine.

These kids are crazy smart…

I just spent a week as a Young Rewired State mentor at work. We hosted 20 kids between the age of 8-17 in a week of code which culminated in the weekend Festival of Code in which the best projects won prizes!

It was awesome!

Properly, properly awesome. I met children literally half my age who had the potential were already better coders than me. These kids are obviously missing skills neccessary to make it in a commercial software development environment, but that’s hardly a failing at the age of 11.

Day 1

So Monday morning came, Day 1 of Young Rewired State. We were expecting 20 kids of varying ages to turn up. We had no idea of their skills, ability or interests. Needless to say, we were nervous. But within five minutes, my nerves had turned to excitement. We had formed four teams with four different and exciting projects. This was going to be a good week!

Day 2

Tuesday. Monday had taken it out of me. I slept for 10 hours. Suddenly my respect for teachers had quadrupled overnight. One of our projects, Growify, a hardware hack for monitoring the health of plants was making great strides. I had, entirely selfishly, convinced the kids that Rails was the way forwards; mainly because I could teach them how to use it rather than stare blankly at anything Javascript based.

We also had an incident involving too much Coca Cola and a spinning chair. I’ll say no more.

Day 3

We banned sugar/caffeine today. Water only. Was a good move.

One of our other projects, Lighthouse, which would help position ambulances near the positions of potential crashes based on previous crash data, was making good progress. They were asking me for help on things I didn’t fully understand. Neither did they, but they were giving it their best shot. This team also just implemented a collaborative workflow using git. They are teenagers! My mind was blown.

Oh, there was also an incident involving a hamster. Again, I’ll say no more.

Day 4

Only mild panic despite the fact that the teams had to finish their hacks today. Everyone was on target, optimism was filling the building. We were certain of at least one project in the finals! Tomorrow was Birmingham and everything had to be perfect.

Day 5

The trip to Birmingham. I have never herded 20 children on and off two trains before. I intend never to do it again (until next year). But the constant fear of possibly losing our smallest member between the train and the platform edge was definitely on my mind. We had arrived though and the evening promised to be full of pizza and interesting talks. I was on supervision duty. I had a pizza so I was ok with that.

Finally saw someone give a talk on git that was aimed at kids. Spot on. Easily the quote of the weekend.

git status is your BFF.

Day 6

Stayed in a hotel. Not on the floor of Millennium Point. +1. Got back to YRS to have one of the kids bound up to me:

I’ve had no sleep. AND. A double espresso.

This was obviously going to be a good day. The afternoon came and all of our kids gave their presentations in the heats. I was so very proud of all of them. They all did the best they possibly could have done and it paid off.

Day 7

The results! One of our projects was awards a special mention and another one had an honorary mention in the Best Code category. Slightly disappointed not to have won, but the kids seemed pleased.

I think we’ll be back next year YRS.

So what?

Personally, I learnt a lot. Firstly, that these kids are crazy smart. And that there is a lot of them that clearly aren’t getting the education they deserve from their schools. Their teachers can’t help them code because they don’t know how to code themselves. Amazing as YRS was (and I hope they carry on!), it’s almost a shame that it has to exist. The skills that these kids learnt during the week shouldn’t be provided by me or other mentors like me. The education system should provide it. YRS should be as well as a proper education in programming and computational thinking not instead of as is so often the case.

Also, I learnt that I don’t want kids yet. They’re hard work. You’re welcome mum.

Let’s Teach Kids to Code!

All of a sudden, programming is trendy. Politicians, teachers and industry all want kids to learn to code. All I can say is YAY!

So you’re a teacher with a semi-interest in computers and therefore you should be leading the charge by teaching kids to code. Again YAY! except, errrr… you don’t know how to code, do you? Ok, first move, buy 30 Raspberry Pis. Surely it’s easy… Nope, wrong again!

Ok, step back. You need to think this through. Your intentions may be good, but if you’re not teaching it right, is it worth doing? I would argue, probably not. Not yet anyway! We don’t let people that aren’t good at things impart their (non-existant) knowledge to people looking for the knowledge, that seems obvious.

Quite rightly, teachers need a degree in the subject that they teach at secondary level. Out of 27,000 teachers that graduated in 2010, three had a computer science degree. THREE!!! So what makes the rest of them qualified to teach programming? In my experience, to teach something you can’t simply be ok at a topic, you have to understand it at its most basic level so that you can fend off any questions and explain any concepts to the most inquistive of minds. That’s what makes the difference between a good teacher and a great teacher.

I don’t believe we can just take our stock of ICT teachers and make them coders to the level where they are comfortable teaching it. This is the real issue.

ICT is computer literacy. This is important but it has very little place in our schools! Many, many children gain this literacy all day, everyday. Software is intuative! We don’t need to teach children to use Microsoft Word, we need to teach children why Microsoft Word is easy to use and why they just instinctively know how to use it. We need teachers that know their classes from their functions and their abstract classes from their loops. Programmers are grown in their bedrooms now, not at school. If technology is the future, we need to fix this!

I’ve had the pleasure of working with children of all ages (8-18) recently and let me tell you. These kids are smart. In some cases, they’re smarter than the teachers! I showed a group of 18 year olds Ruby on Rails this week. We built a blog in 10 minutes. They was an audible gasp around the room when they begun to understand the power of the tools they’re not being taught to use at school.

I know the reason kids aren’t learning code isn’t out of political malice, it’s partly down to lack of funding (isn’t everything?) and most importantly a lack of understanding of the importance of these skills by those who set the curriculums. I bet Michael Gove can’t code, he just gets someone else to make his software. It’s excellent to see strides being made in Wales recently, I just hope it continues.

The Chunky Coder’s Guide to Losing Weight

Some background…

During my three years of being a Computer Science student, I got fat. Like, properly fat. I blame it on a poor diet, no exercise and being a lazy bastard. Mostly because it was my poor diet, lack of exercise and general laziness than caused my BMI to increase from 22 (ideal) to 30 (obese). (I’m 5” 10’)

I’d like to say I spent ages trying to lower my weight because I was aware of the issue. However, that would be a blatent lie. I was partially aware of my increasing weight, but also totally unaware how bad it was getting. Besides, your time at uni is the only time where you can justifiably get fat just because students are lazy and eat lots of pizza. (I should point out, I worked my arse off at uni, just not physically. Most of my work required me to be sat down and eat a lot of junk food.)

I graduated last July with a 2:1 and a weight of 96kg. This was both excellent (the former) and pretty horriffic (the latter). But obviously, it was my last summer before I became a fully paid-up member of society. So, a couple more months of pigging out was in order. And so it was.

Then I got a job. And I felt grown up. And I couldn’t walk up the stairs without getting out of breath. And bits of me wobbled that shouldn’t wobble. But fuck I hate exercise. There are so many other things I could do with the hour it would take me to go on a run. Plus, I was too slow to actually burn any calories. It’d be quicker just to starve myself. HA. That’s not gonna happen. So I guess I’ll just carry on the way I am.

I’m wasn’t like those super-morbidly obese people you see on telly. “I’m fine”, I thought to myself. In all honesty, I was. It was a bit of extra weight, it certainly wasn’t going to kill me.

But then the weight continued to increase. Eventually I realised I needed to do something about it.

So what did I do?!

I always wanted to work in software development. That career that requires you to remain seated for 7.5 hours a day, 5 days a week and usually commands the same of you during spare time. It’s not exactly condusive to losing weight. After a long day of work, the last thing you want to do is go on a run. I didn’t want to go on a run anyway.

My mind is obsessive. It gets obsessed with things I enjoy, quickly. It’s a personality that is natually attracted to software development because it’s a skill that requires an incredible amount of concentration. Coders like order, right and wrong answers. Losing weight is not, I thought, something that I can apply to my usual “do this, get this result” way of thinking.

Oh, how wrong I was.

Firstly, nothing I’m going to tell you here is magic. It’s all horribly common sense. I’m not going to write a Ruby gem with a hipster name like fatty that allows you to rig an arduino in to your stomach to remove excess fat. All whilst playing you a selection of cat gifs. But I will impart knowledge on to you that I have found useful.

Fatty.new(make_me: :thin)

Pick ONE exercise

Geeks (you and me) like to be experts in things. It’s no good doing something unless you can become really good at it, right? I’m not guaranteeing you’ll be the best at whatever exercise you pick, but it’s easier to be an expert in one thing than several things. So pick one.

Take your time, you need to stick with it for at least a year. So try a few out.

  • Join a gym. It wasn’t for me personally. But it cost me £20 and a few hours of my time to figure out that I didn’t enjoy gyms.
  • Try swimming. You’ll find the water supports your weight, but you have to work harder to notice the difference.
  • Go running. (Pick me!) You’ll lose weight fast and there’s a natural progression.

Surround yourself with people who enjoy exercise

It’s easier than you think.

  • My partner’s mother runs marathons for fun.
  • There are several runners in my place of work.
  • My previously overweight father took up running.
  • …as did my sister.

These people are your motivation. Well, people similar to this anyway. You may think all of your friends are all fat slobs. (If that’s the case, get some new friends). I now have spirited conversations about running with various people

Now go and do it

I chose running. I’ve not lived in Cardiff very long and I don’t know the area well except for my immediate location and the area around where I work. Running gave me a great opportunity to explore a new area.

I know you want to become the best runner ever, because that’s what you do, become an expert in EVERYTHING. Tough shit.

Getting to 5k is hard. But worth it. It’ll take you 2 months or so, slowly building up the time. Find yourself a ‘Couch to 5k’ plan and stick to it religiously. There’s hundreds out there, each with varying level of annoying pep talks in the background. I prefer my voiceovers quick and to the point. But there’s plenty that will encourage you every 2 minutes to carry on because ‘you’re doing great’. I was finding it hard to believe after I was told how well I was doing, whilst on the floor in pain. I wanted to call the voice in my ears a liar, but didn’t want to appear insane.


Gadgets make exercise fun. Get yourself an app that tracks you location, speed, time, maps your route. Get a proper pedometer. Get an app that tracks the calories you eat. Honestly, it’s great fun. (No sarcasm, seriously.) Also, by a pair of running shoes. Get gait analysis. It’s yet more cool gadgets to play with. You love gadgets right?

It’s a system. Duh.

Diets suck. But I found treating my body as a system worked well for my brain.

So if we make the very broad assumption that the number of calories your body hasn’t burned at the end of a day gets stored as fat in your body then the fewer calories you eat, the less you will weigh after a while. Let me spell it out to you in a way you’ll understand.

if todays_calories == DAILY_CALS

Great, so if I eat 2500 calories. I’ll stay roughly the same weight. Yup.

if todays_calories > DAILY_CALS

def store_excess_as_fat

And if I eat too much, I’ll put on weight? Yup.

if todays_calories < DAILY_CALS

def burn_stored_fat_for_energy

OH. And if I eat less than 2500 a day, I’ll lose weight. Yeah.

I know, I know, it’s obvious. And you’ve heard it all before. But it’s REALLY important. But your body is a system. It’s more black and white than you previously thought. It’s not even about the kinds of foods you eat. Nutritionists and dieticians can piss off. Eat all the chocolate you like as far as I care, just don’t eat anything else once you hit 2500 calories that day. You’ll feel like shit though, so don’t do that.

What now?

Stick with it. I can honestly say I started actually losing weight at Christmas last year. It’s been a slow process but steady. My BMI is now 27.1 down from 30. My weight loss has been slow, but consistant. I’ve not had to make any major adjustments to my lifestyle. Just a bit less chocolate and a bit more running. Use something like Trendweight to track your weight too. It filters outliers and only shows your general trend. So if you have a fat day, it won’t totally demoralise you.

If you’re a software developer who’s doing the same thing as me and trying desperate to lose weight. Don’t lose heart. You’ll get there. But I really miss dominos pizza.


Tywin Lannister Quote

A nice quote by Tywin Lannister taken from A Storm of Sword book.

The greatest fools are ofttimes more clever then the men who laugh at them.

Tywin Lannister A Storm of Swords

Is Web Scraping Ethical?

Last week I released the UkBuses Ruby Gem. It scrapes real-time data from the Traveline site and allows developers to use the data returned as a Hash. It quickly became the second most weekly starred Ruby repo on GitHub and sparked some interesting debate on Hacker News. There’s strong feelings on both sides of the debate but basically no legal precident on the subject. After debating it with friends and collegues, it’s clear that nobody really knows. First of all, let’s make the question up for debate very clear:

Should it be OK, both legally and morally, for someone to download the HTML output of a non-authenticated webpage and convert it to a format that makes it more easily usable for non-commercial purposes?

There’s two important parts to the question that I have posed:

  1. non-authenticated – In other words, assume that any data to be scraped will respond to a non-authenticated HTTP request and that a typical end-user for that data has not needed to enter any sort of credentials. (OAuth, HTTP Basic or anything!)

  2. non-commercial – The use of the data scraped should not ultimately be for the generation of revenue; profitable or not.

My personal belief is that if either of the two previous conditions have been violated then there are serious ethical concerns that need addressing. In the case of the UKBuses gem, the data conforms to both of those conditions, although there is nothing to stop someone from using the gem for commercial means.

So here’s the arguments that have been put to me and my responses to them. I don’t claim to have the right answers and simply seek to spark debate on the subject.


“[Company] has paid money to aggregate the data. Why do you have the right to take the data and make it available for free?”

This is the strongest argument I have heard so far, effectively comparing data scraping to theft making it both illegal and immoral. However, I would only agree with this if the company who held the data made an attempt to restrict access to it by use of a paywall or other authentication. Since we have already agreed that in such cases, scraping would be immoral (and probably illegal.)

However, in the case of the real-time UK bus data, the data is aggregated for the sole purpose of making that data available to the general public at bus stops and on the Traveline website. Therefore, one can only assume that no money has been lost that would otherwise have been made. So in this case, I would propose a counter question:

“Although [company] has paid money to aggregate the data. Since the data is used on a daily basis by members of the general public, why wouldn’t I have the right to make the data available in other formats?”


“By heavily restricing access to the data and providing no public API, [company] effectively shields itself from public accontability.”

Public transport in the UK often gets a bad time in the press for being late. Justifiably. The UK has one of the least punctual and most expensive public transport systems in the world. Yet, despite central government’s push to open up more data, the privately owned public transport companies have bucked this trend making real-time data nearly impossible to get hold of.

It is, unfortunately, the transport companies themselves that participate in mutual back-slapping of a job well done when they themselves produce reports in to their punctuality. My old local train company claimed 90% in the last month that I used their services. As an admittedly unscientific sample, I would love to know how they got to that figure. There was a point where I could organise my day by the very fact that my train from Bournville to Birmingham New Street would be 4 minutes late.

But I digress. The point is that open data creates accountability. I would love to see someone use the UKBuses gem to aggregate data as to how late buses are and see if it matches up with the figures given by the companies themselves.

Central and local government in the UK is opening up more and more data because they have realised that it creates accountability. I would argue that where there is a strong public interest (I hate that phrase.), certain companies should be compelled to open such data. Public transport should fall in to that category.

Yes, I know that the data is technically available. As long as you fill out a lengthy form, comply with various rules and in some cases provide a deposit for any ‘damages’ caused by whatever your application of the data happens to be. The documentation is in huge PDF files with lengthy examples for how to retrieve the data. This is boring and stifles innovation. Coders like data streams to play around with, it’s part of the fun of coding. Companies with a strong interest in the general public should understand this and embrace it.

Running iOS Unit Tests Automatically Using OCUnit and xctool

xctool is a new command line tool from Facebook which it claims makes running XCode tests much simpler. I agree. Up until now, Apple have still not given developers a simple way to automate running tests at the command line which makes testing a pain and makes continuous integration even more of a pain. It’s not impossible, but it’s not as simple as it should be.

xctool is a replacement for xcodebuild with a few extra handy features. I’m going to show you how to add this to your iOS/OSX project to greatly increase productivity and make testing more fun!

You’ll need the following before we get started:

  • Ruby 1.9.3
  • Bundler

Yeah, you heard me. Ruby. We can use the guard gem to watch to changes to our project and then fire off a build in the command line. It’s as simple as that. Firstly, we need to create a Gemfile in the root of our project.

$ cd /root/of/xcode/project
$ touch Gemfile

Open up the Gemfile and add the following:

source :rubygems
gem 'guard'
gem 'guard-shell'
gem 'fsevent', '~> 0.9'

At the command line, run:

$ bundle install

This grabs our needed gems and their dependencies. Now we’re ready for business.

With guard installed, run guard init shell at the command line. This will create a sample Guardfile to get us started. The Guardfile lists what files to watch for changes and what actions to take when changes are detected.

Open up the Guardfile and add the following lines, I’ll run through what they do in a minute:

guard 'shell' do
  watch(/(.*).(m|h|mm|hh)/) do
    puts "Change detected. Running tests..."
    `../xctool/xctool.sh -project ProjectName.xcodeproj -scheme SchemeName test -reporter plain`

Line 1: guard 'shell' do tells guard to use the shell plugin we included in our Gemfile.

Line 2: This line watches our source files for changes. XCode includes lots of files, many of which change a lot and we don’t want to run our tests everytime those files change. (You might want to, I’m assuming you don’t.) This is just a regular expression which looks at any file that ends with .h, .m, .hh, or .mm (for you Objective-C++ users out there.)

Lines 3 and 4 alert the user that a file has changed, and line 4 runs xctool. You’ll need to change where your xctool is. I keep mine in the root folder of all my personal projects, I tried building a binary and adding it to /usr/bin but I was unable to get it working. You have to pass xctool the project file along with the scheme you want to build. That’s all there is to it!

Go to the root of your project and run:

$ guard

and you’re all set. Try opening your XCode project and making a change to a file. Then just watch your command line automatically run all of the tests in your project. No more clicking in XCode, clever huh?


Getting to grips with Core Data

Most iOS developers will agree, Core Data is hard. The majority (myself included) will wimp out and go and use SQLite, key-value stores in iCloud or just avoid data persistence all together. But I thought I would finally get over the mental block I had over Core Data and just learn how it works.

I’m far from an expert at this point, I’ve had 2 days to get my head around the basics and so far I’m impressed. Here’s what I’ve learnt, hopefully it may be useful.

  • Core Data is NOT an ORM.

Admittedly, it’s pretty close and it functions a lot like an ORM. But technically, it is a object graph management framework. If you expect to behave exactly like an ORM, you’re most likely going to be disappointed. There’s no ActiveRecord-style Post.all method to just yank out all records of a certain class. It differs from an ORM because of its strengths. It is able to deal with potentially huge graphs of related entities with only a limited amount of memory as is often found on mobile devices. (Though less so with the iPhone these days…) It does this by ‘faulting’ data in and out of memory. Let me give you an example: Say we have two entities: Organisation and Person. When retrieving a list of Organisation objects, Core Data will retrieve the list in to memory. It is possible to retrieve the list of People objects in an Organisation even though those people are not actually in memory yet. Core Data ‘faults’ and retrieves the list of objects in the stated relation, loading only what is needed in to memory at any one time. This approach is awesome for low-memory devices.

  • Core Data isn’t just an SQLite database

Yes, Core Data does use SQLite as its backing storage and in debug mode, you can see the raw SQL statements performed on the database, but don’t be fooled, this is simply an implementation detail. The schema may change, unlike the Core Data API. Open up the database and take a look; on large object graphs, it may not look as you expect. Core Data saves the data however it thinks is most efficient, it’s not designed for human-readability at the database level.

  • XCode does a lot of the hard-work for you

There’s a lot of boilerplate code to set up a Core Data stack. But XCode handles this for you, just tick the ‘Use Core Data’ box in XCode and you won’t need to worry too much about it. It creates a Persistant Object Store, Managed Object Model and all that gubbins in your AppDelegate.m file so you can access it à la:

Get hold of a ManagedObjectContext from your AppDelegate
// At the top of your ViewController
#import "AppDelegate.h"

// When the ViewController is initialised...
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
[appDelegate managedObjectContext];
// Assigning your AppDelegate in the first step removes the need for casting.
  • Core Data and iCloud don’t appear to play nice, yet

There have been numerous blog posts about how iCloud doesn’t ‘just work’ like Apple promised it would. Developers were hoping for Core Data stores just to be synced across devices without any problem, apparently that hasn’t happened. iOS 7 may answer some of those issues, but we will have to wait and see.

I’m still learning a lot about Core Data and there is much left to learn.