Month: February 2016

Two heads are better than one

I freaked out the first time I looked at CodeWars.

I was fresh from six months of JavaScript self-study. As it turned out, the knowledge I’d shoehorned so painstakingly into my brain was suddenly nowhere to be found. It had abandoned me.

CodeWars is tough. Even the sign-up process requires new users to complete two code challenges. Once in, the list of problems was overwhelming.

My attitude to programming has changed today after completing the Ronin taster day. I still believe that a collaborative, problem-solving approach is best, but until now I haven’t had much opportunity to develop my coding skills in this way. Most of the code I’ve learned and written so far has been done in isolation, as part of my sometimes lonely digital nomad life.

With me today were eleven participants from around the world, all brought together via video-conferencing. The host started us off with a stand-up session, in which everyone introduced themselves and their goals for the day. He explained how Ronin works and what we could expect from the event.

But more importantly, he explained what the Ronin programme isn’t. It’s not a course in JavaScript or Ruby, although those skills are taught in depth. The overall goal of Ronin is to teach its students to adopt a new mindset. It teaches them to think like programmers.

I’ve been struggling with this for a long time, even while being aware of it. Although I’ve learned difficult things from scratch before (Mandarin, for example), there’s something about talking (and writing) in computer-friendly languages that feels overly abstract and hard to relate to. But to learn programming, one must learn to be comfortable in the unknown.

At least I already know that memorising syntax is NOT the way to become a good programmer. As my successful self-taught programmer friends tell me, Google is there for a reason. I fully agree. I mean, why make life harder?

Most programmers rely on Google to look up bits of syntax. They may memorise certain elements of it, especially the most common ones, but this happens through doing. As Jordan said, ‘you just need to be aware of what’s possible.’

Think about logic first, then code. Decide on the sequence of steps that can take you through the problem from start to finish. Only then should you start trying to translate the logical steps into aspects of code.

It’s essential to develop a hypothesis when you start to tackle a problem.Force yourself to use it and don’t assume anything to be the case. Test everything and be explicit about your expectations.

This is where pair programming can be really powerful.

We did two hours of pair programming during the taster day, programming with two different partners and swapping over the roles. This worked surprisingly well even over a video connection. We were encouraged to keep up a constant flow of dialogue with our partner, to explain what we were doing at every step, and ask questions about what they were doing.

At first there was that scary moment of feeling exposed, nervous about looking incompetent in front of a total stranger. But that soon passed and the process became enjoyable and motivating.

Effective pair programming requires communication and collaboration. Working together over a video link demands extra clarity and precision when explaining ideas and giving suggestions. It becomes easier to figure out problems and both people in the partnership come away with added confidence.

I’ve worked as a language teacher and a journalist so my communication skills are already quite well-honed. But pair programming adds a new layer to that existing ability. It’s unlike anything I’ve done before, but I found it very fulfilling and even fun! An hour passed by in a flash.

Now I need to go and practice my regular expressions. Those are tricky!

Adventures in data

data lightbulb eureka

Data journalism fascinates me. It seems to be the natural path to take if I want to intersect my existing background in freelance journalism with my newly developing skills in tech. As I progress further in my programming studies, most recently delving into the basics of Ruby, I’ve become increasingly convinced that data-storytelling could be my next career move.

Hacking together small projects is the best way to begin, so here’s my very first attempt at finding story ideas in data. I used a simple two-column dataset taken from the Socrata Opendata website. The set showed recent World Health Organisation (WHO) data, showing pure alcohol consumption around the world per capita. There were two columns, one for the country name and another for the per-capita amount in litres.

I grabbed the dataset from Socrata in .csv format. It was already fully cleaned and ready to be used. I was aware this was an easy ride. I know tables and rows this perfect aren’t usually found in normal journalistic data gathering. I uploaded the whole dataset into a tool called Silk, which arranged it nicely into ‘data cards’.

Using Silk, I was able to view the data set in a variety of ways, including bar charts, maps, pies and tables. I found that mapping the data was an obvious choice in this case, for such a geographically-focused dataset. But the below table was what really helped me find some interesting potential story ideas that could be pursued further.


As you can see above, the countries have been sorted into groups according the amounts of alcohol consumption per capita. Considering the extremes is always a useful practice when searching for newsworthy angles. In global national stereotypes of drinking, which countries would be the most obvious contenders to come top in this dataset?

Russia, Germany, the UK, and Ireland immediately came to mind. But surprisingly, it was little Luxembourg that topped the charts for global alcohol consumption, with a whopping 15.56 litres of the pure stuff per capita. I have no idea why the people of Luxembourg drink so much, but this could be the first surprising angle to pursue from the data.


The next obvious place to look was the countries where people drink the least alcohol. There are four places where the pure alcohol consumption is 0.0. Unsurprisingly, they are all Muslim majority nations. Saudi Arabia and Iran, along with Bangladesh and Somalia, all have a score of 0.0. The group of 0.0 – 0.03 litres is populated solely by Muslim countries, but there’s a surprising exception.

Qatar is missing from this group. This intrigued me. Having lived in Qatar for a couple of years, I knew that alcohol is strictly controlled there. It can be purchased in two kinds of places: the bars of five-star hotels (accessible only with a foreign passport), or the government-controlled liquor store.

The latter is heavily regulated. Expats require permission from their employers to apply for an ID and use the store, which sits far out in the desert. Plus, to be eligible for the ID, expats must be paid a salary of over 4,000 Qatari riyals per month (around 1,000 USD). This means that purchasing alcohol is impossible for many low-income foreign workers.

So how much pure alcohol per capita do they drink in Qatar? 4.40 litres per capita! That puts the strict Islamic emirate ahead of around 85 other countries, including places such as Georgia, Albania, and Jamaica, where people might be reasonably expected to consume greater amounts of booze (taking cultural, religious and historical assumptions into account). At least compared to Qatar, which outstrips every other Muslim-majority country.

Another part of the data that stood out to me was the significant different between levels in Qatar compared to the United Arab Emirates and Oman. I’ve visited both of the latter. In each I found that access to alcohol was far less restricted than in Qatar.

If I were going to pursue a story from this dataset, that’s where I’d begin searching. For the next steps, I’d look for additional data to support this early idea, to see if it’s an actual trend in Qatar or just a misleading statistic (after all, there’s “lies, damn lies and statistics.”).

The above would involve finding more sources while also talking to people on the ground in Qatar to see if they could help me trace the factors driving this aspect of the WHO data.