January 27, 2013

Geek's take on NHL

Few years back I wrote a piece of software for tracking sport results. It was a standalone application using an in-process open source database. While it was OK, it required some setting up and I never quite finished it. Therefore I used to run it through the IDE. The user interface for adding the game data also felt a bit clumsy and eventually I lost interest in continuing the development. Perhaps there was just too much design compared to what I actually wanted.

I'm not a big sports fan, but it's really nice that NHL is on again. From the betting perspective, NHL seems to be quite a challenge. This gave me some extra boost to come back to the original problem of recording and analyzing the sports results. I decided to start from scratch and build a very primitive solution with minimal maintenance burden.

The first problem was how to store the data. I wanted a text based format so that I could easily create some test data to play with. I chose JSON format, which is supported in many platforms and languages and is more simple than XML. JSON format didn't practically set any restrictions for other design decisions.

I wanted an effective programming language with good libraries. Choosing Python was easy, as I also wanted to improve my skills with it. With Python I would have a cross-platform application, although the interpreter is required to run it. For me, that's not really a restriction.

The first goal was to read and and print some game data to the console. With Python JSON libraries this was a no-brainer. In addition, I created some simple model classes I would need later. I found adding the game data in text editor a bit error prone, so the next thing was to find a better solution for it. I decided to temporarily extend what originally was just a printing script to write the game data and created a command-line support for adding game results. This was a lucky accident. Using command-line was so fast that creating an as effective GUI for the same purpose is not a trivial task.

My project is now in a point where I have an unprofessionally built Python script already doing some filtering and analysis from the game results. Building the functionality with Python was amazingly simple time after time. The end result so far is not what thought it would be. It's not professionally built software, but still simple, fast and effective. Considering the spare hours invested during the last two weeks and how useful the application already is, this must be one of my favorite projects that I will remember for a long time.

I will continue adding new command-line functionality and refactoring the existing code to make it more modular. After this it's hard to say which direction the project will take. The original thought was that I need a GUI. Now it feels more as optional. The project has also been a good reminder about how powerful a simple command-line interface can sometimes be.

Let's see if my new tool can really help me pick the right NHL games to bet on.

No comments:

Post a Comment