Abstract

Code Share is a directory of open source code projects covering all aspects of the Force.com platform. You can browse and access the source code for these projects to learn more about the code, or create an account of your own on Code Share to collaborate with project owners and other members on existing projects. You can also create and register projects of your own. This article provides a brief introduction to getting started on Code Share.

Is it a Code Project or Code Sample?

Code Share is a directory of open source code projects. The idea is that you, and potentially others, work together on the source code for the project. As such, the source code is typically hosted in a way that permits team development - something like Google Code.

If you have a code sample instead of code - in other words you simply have some source that you'd like to share, then instead consider creating a Code Sample. See the Code Samples page to add and create code samples.

Prerequisite to Setting Up a Project

A code project typically has a number of elements:

  • Source code with a license
  • A host for that source code
  • A Force.com install package

The following sections look at each of these aspects in more detail.

Your Source Code

The source code is really what your project is about. It's what will draw other developers to your project, and it's behind the bits that execute! All of the source code on Code Share is open source - in other words it's shared with everyone.

You should choose a structure for your source code that makes sense for your project. Typically this may follow the metadata structure that the Force.com IDE uses when it grabs the metadata from your Force.com environment.

Your source code typically has a license attached to it as well, which describe the terms under which it may be used. Many of the salesforce.com contributed projects, such as TwitterForce, Force.com for Facebook and Force.com for Google App Engine, use the New BSD License.

A Host for your Source Code

Code Share is all about collaborative code development, and as such you need to host your code in a way that lets multiple developers download, and potentially contribute, to your code. This is typically accomplished by using a code repository, such as Subversion. See Using Force.com with Subversion for Team Development for how teams can use Subversion.

Most of the code projects on Code Share use GitHub or Google Code as their host. This provides a nice web interface to your code source, as well as git/subversion support, as well as support for collaboration - especially on GitHub.

An Install Package

If your code is pure Force.com, consider making a one-click unmanaged package install version as well. Providing a quick route to installing your application or library is a sure way to get more folk excited about it and trying it out. See Packaging to learn more about this.

Adding a Project to Code Share

Code Share is a directory of projects, and once you have your source code hosted, and (optionally) an install package to hand, then you're ready to create add your Code Share project to the directory. The following steps walk you through the process of adding a project to Code Share.

Log In

Navigate to Code Share and login by using the login link:

Codeshare login.jpg

One you're logged in, you'll notice that the "My Code Share" panel changes to expose the "Create a Project" link. Select this action.

Codeshare createlink.jpg

Create a Project

You will now be asked for your project details.

Code project details.jpg

The details you'll need to have at hand include:

  • A name for the project
  • A description of your project
  • The URL of the source code - this will typically be the URL of your source code in a web-based subversion repository, such as Google Code
  • An optional install URL, if you've created an unmanaged package of your code
  • A comma-delimited set of tags. Check out the existing set of tags to get a feel for which to use.

Once your project is created, you'll be able to edit the description to add additional links - perhaps to documentation, or an article on the project and so on.

Editing your Projects

If you ever want to edit your project, perhaps to include additional links for to modify the description, then log in again and click on your name in the "My Code Share" panel.

Best Practices

Ideally you not only want developers and users to use your code, but you also want some to join your code project and contribute to its development. As such, here are some best practices that we recommend:

  • Provide a title and description that clearly describes what your code does, and what someone would gain from using it.
  • Use a friendly license, like the New BSD License.
  • Try and provide an unmanaged install package, making it even easier for someone to use.
  • Document any additional installation instructions, and point to these instructions.
  • Ensure that your Google Code project points back to your listing on Code Share
  • If you can, provide a graphic of your code in action (example)
  • Rate other code projects you like
  • Post a link to your Code Share listing in an appropriate Discussion Board

Summary

Code Share is a directory for open source code projects. Creating a project is a matter of logging in and creating a directory entry to describe and point to your hosted code.