Craig Marvelley

Software and such

For the Social Good – Box UK Hackday #1 Recap

On the twentieth of November, 2011, the company for whom I work (Box UK) held a hackday in Cardiff at the Student’s Union. It was the first time that we’d organised such an event, but it seemed to go really well – feedback from the participants was good, it was well attended, and personally I had a really good (if stressful!) time.

The theme of the hackday was ‘For the social good’ – applications built during the day had to have some sort of social theme, ideally to improve the lives of the people that would use them. That’s quite a broad topic, and it resulted in an array of different apps – not just in the sense of intended purpose, but in style, and also in platform. While teams typically used scripting languages to build their apps within those used (PHP, JavaScript, Python) were a lot of varied frameworks (Symfony2, Lithium, Django, jQuery Mobile, Node.js, PhoneGap and more), as well as SQL and No-SQL solutions alike. I initially suggested creating an iOS app, until it was pointed out to me that the verbose nature of Cocoa meant we’d probably only get one class done in the 8.5 hours we had!

My team comprised of myself; Paul, a former colleague, and Tom, a 3rd Year student at Cardiff University. Paul and I had decided to try to create a mobile app that used geolocation to provide the user with trivia and quizzes for the places of interest around them; we were only going to concern ourselves with Cardiff, so it would be a tourist aid for the city, or perhaps a learning tool for schoolchildren. Tom then joined us, and had originally wanted to work on a Corkboard-style app – after a discussion we modified that into a Q&A app which would be incorporated into our exploration tool idea, so the user could additionally ask questions and receive answers in realtime. That was the idea, anyway. We had 8.5 hours to implement it!

Photo courtesy of

We split our responsibilities up such that Paul would build the mobile app (he plumped for jQuery mobile, version 1 of which having been released just days earlier), Tom would build an app to aggregate questions from users and allow a pool of authors to submit replies (he wanted to use Cappuccino), and I would build the webservice/content management system both apps would run on (I thought Symfony2 would be a good framework). It sounded good in theory, but then it always does.

I’ve dabbled with Symfony2 since it was in beta so I knew what it could do, but not necessarily how to make it do it. So the first hour of the day was spent scanning the documentation and looking through the available ‘bundles’ (Symfony nomenclature for packages of redistributable code) to see what community efforts I could re-use. I came across the SonataAdminBundle relatively quickly and it seemed a good fit – its purpose is to generate a CRUD interface for the models within the application’s domain. This would give me a quick way to add and manipulate the data in the app, so I plumped for it. I guess it’s a bit risky using an unknown in a hackday since if it turns out to be unsuitable, there’s not a lot of time to try something else – but I thankfully had no such problem here.

The SonataAdminBundle is impressive, in that with relatively little configuration and code I had a very functional app. The project documentation assumes a fair bit of Symfony2 knowledge from the developer, which isn’t ideal in a high pressure scenario where I didn’t really have time to read the source code, but I’d worked it out by lunchtime. I’d say within a couple of hours I had an app with which I could create models, specify forms which related to them, and manage data.

Most of the rest of my day was spent working with Doctrine2, a PHP ORM that is tightly integrated with Symfony2 and the SonataAdminBundle. Doctrine2 I found to be the perfect tool for a hackday – create a class, put some annotations on properties to define the type of the field, and any relationship to other classes, then run a command line script which generates all the accessor code, and even updates the database schema – saving a substantial bit of work. There were some hiccups along the way, but I did manage to get a webservice together which could supply Paul and Tom’s apps with data.

By this point we were running quite low on time (I think I spent too long chowing down on the copious amounts of free pizza!), and so rather guiltily I left the other members of the team with only an hour to integrate the webservice into their apps – both were true heroes though, quickly turning everything around so that we could demo something fully featured to the other teams.

Each of the other teams not only produced an app (I’ve been to hackdays where people don’t even get something together to demo, which is a little disappointing) but it was also gratifying to see that each app was functional, innovative and different. My personal favourite was Tomazs’ mobile app for the Welsh Premier League (it doesn’t get enough love!), but the team (who produced a mashup of several data sources to plot on a UK map areas at risk of accidents due to poor weather and lack of gritting), who won first prize, and a team of several 1st year Cardiff Uni students with another former colleague at Box UK, Warren Seymour, who took second with a cool Corkboard app for university students, thoroughly deserved their awards.

It was also great to see Tom take the best individual developer prize, as he demonstrated some serious coding chops despite having to wait until the very last for the data his app depended on. He also ran into some issues with Cappuccino during the day, and rather than abandon what he was doing, he just switched to Prototype and got on with it in a very pragmatic fashion.

As a bonus, after the prizes were handed out we decamped for a drink in the Tafarn, something I haven’t done since leaving Cardiff University 10 years ago. It was almost worth attending the event solely for the excuse to walk down memory lane!

The code for the CMS app I built can be found on my Github page. Time permitting, I’d like to take the idea a bit further; though it’ll require a bit more planning than the 15 mins it got on Sunday to be a proper success!