Archive for December, 2009

Source control and me – Why I use git and github

The biggest change to programming for me this year (apart from spreading out from just PHP and Javascript) is that I now use source control for most of my projects. I started out on subversion because it was widespread, easy to use (with TortoiseSVN, I was still a Windows “everything must be GUI” user at the time), and there was a handy tutorial for it published for it on a blog I happened to read. I used that for a good while until a friend showed me git and github. I’d used Sourceforge and Google Code for a while, because although my projects are too small for anyone else to be interested in adding to them, the benefits of having a remote source control service that’s always accessible from any computer are huge for me. And it’s handy for showing people the program in more detail if I need help on Stack Overflow.

While I was (and still remain) unconvinced about the benefits of distributed source control versus normal source control, and more specifically of git vs svn, the benefits of github versus google code (which I had been using at the time) were more than enough to convince me to make the switch. It also helped that at the time, Linux had recently become my main OS with Windows being relegated to usage for syncing my iPod Touch and gaming, and I had become much more familiar with CLI usage of the system, so the command line orientation was no longer the problem it once was.

Branch history of a small github project

Look at the pretty graphs! (ignore Chromium for Linux's fail at positioning. My cursor is actually on that big green dot on my screen. It's just the screenshot gone wrong. This is the fault of flash+chromium, not github)

Setting up git and github was simple. I could give you instructions on how to do it, but Sirupsen has already done this much better than I could for Linux users. For Windows, there is another tutorial hosted on github,

Usage of git with my github account is equally simple.

  • Change files
  • git commit -a
  • Type commit message into nano (or vim if you’ve changed your system editor, or notepad if you’re on Windows)
  • git push origin master

The only thing I missed during switching was that Subversion numbers revisions like 1, 2, 3…20000 while git uses md5 hashes. But I can live with that.

Programming: Simple Python Todo List manager

My latest programming project is a todo list manager written in Python.

Features

  • Add, Remove and show items
  • Manage multiple lists
  • Lists are stored in JSON

It also has a GUI, but that needs a lot of work. As always, the source code is available on my github. Unusually for my projects, it is already fully functional (though as I said, the GUI needs a little work).

The Playground

Over the last 2 years, I’ve done a lot of personal programming projects. Some of these are available on my github, but any information about them is spread among Twitter and a few forums (some of which no longer exist). So over the next month, I’m going to blog about a few of these. I’ve chosen the name “The Playground” for the category because it accurately reflects both the nature of the projects (small projects that are mostly tinkered with, with very little concrete plans) and the reasons for making them (to practice programming, or to mess about, or because I was bored).

Anyway, for the time being, here is a quick summary of my projects currently in my github repo:

Twitter Matter

This is a simple Python program to send tweets from the command line. At the moment, it can send tweets, and get the latest tweets from your timeline, your friend’s timeline, and @replies to you. I made it mainly because although I’ve always said Python looks like a nice language, and I know the basics of it, I never wrote an actual program in it beyond Project Euler maths puzzles.

JavascriptCity (aka Webcity, webicity, JSC)

This is an attempt to write a Simcity clone in Javascript. I got quite far into it, with the ability to set zones, have them develop and build roads actually working. However, at the current stage any change I make is too bad for performance that it is basically on hold. I can say it’s definitely not impossible to write a Simcity clone in Javascript, but you need someone with better Javascript skills than me to make it, and probably someone who knows about <canvas>.

Young Developer Forum

This is a program set up by me and a Iroup of people on a forum which has since shut down. It didn’t really get very far.

Machat

This is an IM server and client that I wrote in Java. It was my first experiment in GUI programming and Threading in Java. Some revisions of it work, and some don’t.

JS Battleship

This is a battleship game I am writing in Javascript. It re-uses a lot of code from JavascriptCity, but without the huge 200×200 table grid that caused a lot of programs.