I'm looking at Google Code, SourceForge, BitBucket, and GitHub, since they seem to be the big players. Now, I haven't broken down all of the features that they provide yet, but I'm really looking for a place to put various code that I write (my solutions for Project Euler, code that I might write for the Code Golf/Programming Puzzles Stack Exchange, and so on) in a centralized location.

So, my first question is: For a situation like this, does one service stand out among the others?

Once I've chosen a service, I then need to choose how I'm going to distribute the code. There are a few options that I see for setting up the repositories and projects. A single repository can hold any number of projects - for example, I could have a "Tom Owens's Project Euler Solutions" repository for all of my various solutions to Project Euler, with projects for each language and environment in directories within this repository, another repository for my various Code Kata solutions and so on. Or I could break something like that down by language (have Project Euler solutions in Python in one repository, PE solutions in Java in another repository, and Code Kata C++ solutions in a third repository).

My second question: Are there any limitations or conventions that exist for determining how you should share your code samples that you choose to make open, especially in terms of how you create your repositories? My thought is that this might be dictated by the service that you choose (based on the conventions of the community).



They provide an excellent service, private repositories in their free package (plus unlimited public) and are pretty responsive in their issue tracker.

The same, minus the free private repositories, are true for Github, but I immensely dislike git. That's a personal preference, I'm not advocating against git, if for some weird reason you prefer it over hg, then Github is a perfectly valid choice.

As for how to organize the repos, don't mix languages if you can avoid it. Most IDEs are built around the assumption that a project is build on a single language (except for web projects where a combination of language + html, css & js is expected). I'm not saying that the IDE won't be able to cope, just that features like code completion will be a little slower as the IDE will have to load data on how to handle each language.

If your repos are public (hence unlimited), I'd go for a repo per language per project schema, ie "euler_cpp", "euler_python", etc. It doesn't really matter what service you choose, how you organize your repos is completely up to you.

As for folder structure, for project euler solutions:

  • A folder per problem, if you are planning to have different solutions to the same problem
  • A file per problem, for single solutions

Pick the one that applies and stick with it, if for one problem you have more than one solutions, pick the first structure even if you don't have a second solution for any other problem.


The one file per problem is proposed only for when its actually applicable and it's suggested as a potential schema for solutions to project euler problems, as this is the only project that is specified in the question.

As per btilly's comment I'm adding that the better / more natural structure should be decided per language, as each language and / or platform has it's own conventions & practices regarding files and folders.

  • 1
    Folder structure should depend on the language. A person using a scripting language frequently writes code in one file which in C/C++ would naturally be written across several files in a folder.
    – btilly
    Jun 1 '11 at 18:00
  • @btilly Right. I'm adding your comment to the answer...
    – yannis
    Jun 1 '11 at 18:03
  • I actually wasn't looking for specifically how to lay out files within a project, but how to lay out a number of projects within the service used.
    – Thomas Owens
    Jun 1 '11 at 18:17
  • @Thomas As for how to organize the repos.... Traditionally you would have one project per repository. Are you looking for specific instructions on each service?
    – yannis
    Jun 1 '11 at 18:21
  • What I'm looking for are any conventions that exist within each community, if there's anything out of the ordinary. In my experiences, things like BitBucket, GitHub, and SourceForge are more of communities with norms and conventions than simply services (although some people use them like services).
    – Thomas Owens
    Jun 1 '11 at 18:26

You forgot one option -- hosting your own repository. Really was the only way to fly until recently.

If I had to use one today, I would choose bitbucket mainly because they allow private repos and mercurial rocks.

  • I did this with VisualSVN without much pain.
    – Cody Sand
    Jun 1 '11 at 21:40
  • Been there done that. You can get even more effective with turnkeylinux.org appliances . . Jun 1 '11 at 22:21

After using Google Code, SourceForge, and GitHub at different points in time, I'd say GitHub is much better than the other two:

  • Focuses completely on the actual work of creating and sharing code.
  • Issue handling is enabled by default, and is not just simple to use, but well connected with both code and pull requests.
  • Newbie help is excellent, such as step-by-step instructions for getting started with a repository and for handling pull requests.
  • Not meant for binary distribution; this is better handled by specialised sites like PyPI.
  • Simple wiki instead of having to develop your own web page from scratch.
  • Excellent feed support - A single feed for everything interesting to me.
  • Informal, and thus readable, communication.
  • Very active development of new features.
  • Also, Github is perfect for storing things like Project Euler solutions and code golf snippets through the use of gists.
    – Matt Ellen
    Jun 3 '11 at 9:24

My personal projects aren't very big (lots of text, no graphics), so I have Mercurial repositories with the masters in DropBox. It's a quick way to get started with backup (if DropBox goes away, I've still got a copy of the repository on each computer I own) and portability.

Assuming I have a project that gets to the point where I want to distribute it, I can always move it to Bitbucket for greater visibility. This doesn't include code for Euler Project solutions.

Not the answer you're looking for? Browse other questions tagged or ask your own question.