If you’re going to this weekend’s Random Hacks of Kindness, it’s worth your time to familiarize yourself with some collaboration tools.
I’ve attended two RHoK “hackathons” in Toronto. Over two days, great people from diverse backgrounds work together to create tools with the capacity to impact lives. One common issue is adjusting to collaborating in a development environment, particularly with teammembers in other cities. Two days is sometimes not enough time to bring all contributors up to speed.
Time is limited, so it’s important to be productive as soon as you can. If you’re new to hackathons, you owe it to yourself and others to brush up on some tools. The following tools will help you work faster, especially when collaborating with others. Quite likely the most important collaboration tools you’ll use will be version control and group chat. I’ll also touch on libraries and tools to consider.
Version control (AKA source control)
If you’re collaborating on a code base with others, I strongly recommend that you use some sort of version control for your project. Version control, or often “source control” in a software development context, is a method to keep track of changes to files. Changes, or change sets, detail the time a change was made, who made the change, comments on what has changed and why, and, of course, what the exact changes were. The typical workflow under source control is:
- “Check out” (or pull) the current version of the project code to your computer from a project repository (which is denoted by a URL),
- Make a change to a file or a group of files in the project on your computer,
- “Check in” (or commit) your changes with a comment, adding new files as needed, and
- “Push” your committed changes up to the project repository.
There are many source control systems in use. At Random Hacks of Kindness, you’ll likely be using one of Subversion (or SVN), Git or Mercurial (usually abbreviated “hg”). SVN is a system with a central remote repository, while Git and Mercurial allow for a decentralized approach, with multiple repositories which often feed into a central one.
It’s tough to say which of SVN, Git or Mercurial is easiest to use. SVN commits immediately to the repository. Unfortunately, this makes it easier to break code and negatively impact others in SVN. Commit conflicts (ie. When two changes to the same piece of code are merged together.) also happen more readily in SVN and are tricky to resolve. In my experience, the distributed nature of Git, its superior handling of merges, and its dominance in the open source community make it a natural choice for a hackathon.
How to install Subversion, Git or Mercurial
All three of SVN, Git and Mercurial have download pages with instructions on how to install both the command-line and GUI client applications. These can be located at:
- SVN: http://subversion.apache.org/packages.html
- Git: http://git-scm.com/download
- Mercurial: http://mercurial.selenic.com/wiki/Download
Note that as of Mac OS Leopard, SVN is included as a command-line application.
The very basics of Subversion, Git and Mercurial
Subversion works much like the workflow outlined above, with one difference: the push step is automatic. You will check out the project from a URL, make your changes, then commit those changes to the central repository. To complete the commit, you’ll be prompted for a comment. Changes are immediately published to the central repository, which is why we don’t need a push step. Using the command-line, this workflow would be translated to:
- Check out the repository. You only need to do this once:
svn co <project URL>,
- Update the code on your local machine:
- Add files, make changes to existing files,
- Check in:
Git and Mercurial work as outlined in the typical workflow. The push step is required here. The code you edit and commit on your computer is committed locally. Sets of commits are then pushed up to a remote, often central, repository. As with Subversion, every commit will prompt for a comment.
Using the command-line again, this workflow for Git could be translated to:
- Copy (or clone) the remote repository once:
git clone <project URL>,
- Pull any changes from the remote:
- Add files, make changes to existing files. If adding files, add them with
git add <file>,
- Commit to local:
git commit -a, and
- Push unpushed commits to remote:
The Mercurial workflow is very similar:
- Clone the remote once:
hg clone <project URL>,
- Pull new changes from remote:
- Make changes and add new files with
- Commit to local:
hg commit, and
- Push to remote:
Now you know the absolute basics for working with the three most popular source control systems.
Where to go for more information
Source control is a powerful tool, with many options and features. To learn other frequently-used commands, please consult the following resources or search for others on Google:
- Learn more about Subversion from a York University quickstart guide or the free SVN book.
- A decent reference for Git exists as well as a free book, Pro Git.
- Mercurial has some great beginner’s guides.
If you can’t find what you need online, don’t be afraid to ask other members of your team for help.
Free source control hosting
If none of your team members have created a central repository for your files, there are a number of free sites available. Two of the most popular for RHoK participants are Google Code and GitHub.
Google Code can now host Subversion, Git and Mercurial repositories. Hosting on Google Code requires a free Google account, as does collaborating with others. As an owner, you’ll need to get the Google account IDs of everyone on the project, usually an email address ending in “@gmail.com”.
To collaborate on an existing project on Google Code, you’ll need to give its owner your Google account ID. He/she will then add to the project. You can grab the code by going to the Source tab for that project, where you’ll find instructions on how to get a hold of the source.
GitHub is the standard for solid Git hosting. As with Google Code, participation requires a GitHub account and authorisation of collaborators. Accounts are free. You’ll also need to set up an SSH key, which is covered in the setup.
As both Google Code and GitHub are fairly common sites, someone will be able to help you with setting one up. Ask around if you get stuck.
There is a third option of hosting your repository yourself, from your computer. This is a little involved for novice users, but is covered in the information guides.
Communicating with your teammates
If you’re working on a project with people in other locations, you’ll need to be able to communicate with them. Three common methods of communication at RHoK are Google Talk, Skype or IRC. With Google+ hangouts available, that may be a fourth option.
Google Talk and Skype are likely the easiest options for communications. Both are free, support text chat as well as voice and video chat. Skype is a free download while Google Talk can work in a web browser. Naturally, using these services will require an account, which is free.
In Google Talk, any chat can become a group chat by clicking “Group Chat” in the Google Talk Gadget. On Skype, you can arrange people into groups and create a room for that group. Group voice or video chat is only available on Skype, and only with a Premium Account.
IRC (Internet Relay Chat) is primarily geared towards chat rooms, although private one-on-one chats are supported. You will need an IRC client. Most chat applications have an option for connecting to IRC servers, but dedicated clients are available. On the Mac, Colloquy is a popular choice, while XChat is a good choice on Windows, as it is on Linux. Linux users, check your package manager for XChat or irssi should you prefer the command-line.
IRC provides simple commands for changing settings, setting up rooms, etc. Commands are sent to the server, which you’ll also need. Freenode is popular in the open source community. Point your client to
Lastly, Google+ Hangouts supports text chat and group text and video chats. It’s free, but as with all things Google a Google account is required. Once you’re in Google+, you can start creating a hangout for your team members.
A brief note on libraries and tools
The proper collaborative tools will end up saving you time. Another way to save time is to avoid repeating the work of others. This includes current or past RHoK participants, as well as others in the industry. The open source developer community has spawned countless developer libraries for all languages. If you find yourself writing code which should be commonplace, it probably already is.
It’s imporant to familiarize yourself with your programming language’s offering. Install some core libraries beforehand, or know how those can be installed should you require them. Try to avoid spending the weekend reinventing existing functionality if it’s a small part of your RHoK solution. Unfortunately, it’s not always obvious that you’re reinventing an existing technology. Be sure to ask around and see if what you need already exists.
Developing for mobile
Many problem sets involve a mobile or wireless phone component. If you plan on doing some mobile development, be sure to have the necessary tools installed on your laptop before you come to RHoK. These are often large downloads and will consume time:
- Android SDK: http://developer.android.com/sdk/index.html
- iOS (iPhone, iPad or iPod): http://developer.apple.com/devcenter/ios/index.action
An Apple Developer account is required to download development tools for iOS. A DVD containing XCode and iOS developer tools should have come with your Apple laptop. You may still need to download XCode updates.
Note that if your development background is more geared towards web, you may find it easier to leverage some features of HTML5, including support for geo-location and client-side storage. HTML5 is a relatively new specification with many modules still in draft. Before deciding on using its capabilities, check whether your target devices are supported.
Sorry, this guide is far from complete
It’s impossible to list every tool. These are just recommendations based on my experience and those of others. They are meant to be starting points for participating effectively in Random Hacks of Kindness. Depending on your project, it’s likely you will need to install other tools. As always, ask around your event space if you get stuck or need help.