12

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).

Thomas Owens
  • 79,623
  • 18
  • 192
  • 283

4 Answers4

10

Bitbucket.

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.

update:

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.

yannis
  • 39,547
  • 40
  • 183
  • 216
  • 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 01 '11 at 18:00
  • @btilly Right. I'm adding your comment to the answer... – yannis Jun 01 '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 01 '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 01 '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 01 '11 at 18:26
  • So in your answer, since you favor BitBucket, is there anything I should know about structuring my projects across my bitbucket account for maximum efficiency/ease of use so I don't end up fighting the system? – Thomas Owens Jun 01 '11 at 18:27
  • How can you say this about git? Then again, I haven't tried Mercurial... – Anto Jun 01 '11 at 18:40
  • @Thomas BitBucket offers [mercurial](http://en.wikipedia.org/wiki/Mercurial) based repositories. You should research mercurial and see if it fits your needs, BB is great as a service but if mercurial is not right for you then its useless. BitBucket is [very easy to learn](http://confluence.atlassian.com/display/BITBUCKET/Using+your+Bitbucket+Repository). If you feel you cant decide do post a question here specifically for mercurial so you can get detailed and specific answers. As for the community, it plays absolutely no role (positive or negative) at all at how you structure your project. – yannis Jun 01 '11 at 18:41
  • @Anto I even think *svn* to be a better tool than git... But that's just me (and probably only me). – yannis Jun 01 '11 at 18:45
  • @Thomas Im getting the sense that your question has evolved a bit. Could you please edit your original question to be a little more specific on what you're looking for? Comments are not the best place to expand the scope of a question... – yannis Jun 01 '11 at 18:49
  • I'm not expanding the scope, but I can try to clarify the second part of my question. – Thomas Owens Jun 01 '11 at 19:11
  • I second bitbucket. Simple no-nonsense interface, integrates perfectly with mercurial, and you get unlimited storage. Only downside is that the free account limits the number of people you can give commit access, but with hg, I consider this a very minor downside. – tdammers Jun 01 '11 at 21:21
  • @Thomas Expanding the scope of the question is a good thing... Just put your clarifications in the question, not in the comments. – yannis Jun 02 '11 at 01:05
  • @tdammers Write access is unlimited for public repositories: http://confluence.atlassian.com/display/BITBUCKET/Giving+People+Access+to+your+Bitbucket+Repository – yannis Jun 02 '11 at 01:07
  • @Thomas Check out this recent [question on mercurial workflow](http://programmers.stackexchange.com/questions/80891/understanding-my-dvcs-workflow)... It has some good pointers in the answers already. – yannis Jun 02 '11 at 01:30
3

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.

Wyatt Barnett
  • 20,685
  • 50
  • 69
3

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.
l0b0
  • 11,014
  • 2
  • 43
  • 47
  • Also, Github is perfect for storing things like Project Euler solutions and code golf snippets through the use of gists. – Matt Ellen Jun 03 '11 at 09:24
1

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.

David Thornley
  • 20,238
  • 2
  • 55
  • 82