Feature guidelines

A feature is basically a set of files stored in a folder. Each feature is scoped at a certain level (Farm, Web Application, Site Collection, Site) and can be activated or deactivated on demand. Internally features are referenced using a GUID, but on the file system a more human name is available.  The challenge is that all features are stored in the same folder, so the name is globally unique.

If you wanted to create some Administration links for your solution, you couldn’t call it ‘AdminLinks’ since Microsoft already has taken that name. Creating a feature with a generic name is not a good idea either because somebody else might also be using that name.

The way to get around this is to introduce a naming convention for your features. If you use Visual Studio 2010, the default name of features is <wsp file>_<feature name>. My personal preference is to use a three part dot notation for most cases.

<system>.<area>.<feature>

For each of the parts I have further conventions.

<system>

This represents the project the code is being developed for. If you are developing  a system for The Ministry of Silly Walks, the abbreviation MSW could be appropriate.

<area>

This represents the various functional areas.

COL = Collaboration
PUB = Publishing
SEA = Search
REC = Record Center
MYS = My Site

If left empty it’s applicable across multiple areas.

<feature>

Finally we come to the name of the feature. This should be something that illustrates the function of the feature. Here there are also certain names that I reserve for specific use.

Farm: Things to do at the farm level
WebApplication: Things to do at the web application level
Host: Things to do at the root site collection level (inspired by MySite Host)
Styling: Provisions the files required for visual styling/branding.

Examples:

MSW.COL.WebApplication
MSW.COL.Host
MSW.COL.DocumentLibrary : Customized collaboration document  library.

Experiencing name collisions using such an approach should be rare.

Once the name has been established, what other configuration changes should one consider?

Deployment Path is where you enter your custom name based on an appropriate naming convention.

Title and Description are always useful to fill out.

Activate on default is only applicable to features scoped to farm and web application. If this is active on a web application scoped feature, every web application that is created after this feature was deployed will get this feature activated. If you are writing code that is just so cool that everybody just has to have it, then go ahead and keep it active. If you like to give users the choice of activating your functionality, then let them explicitly activate it. They may of course deactivate it afterwards, but then the damage may already have been done.

IsHidden determines what features to show in the feature list UI. Features cannot be scoped to a single application; they are globally available. Features that are designed for a specific environment, i.e. My Site are available to team sites, search centers and anything else. Try to hide as many features as possible to reduce the potential for confusion. If a feature will always be activated as a result of site provisioning, there is very little point in making it visible to end users.

Version is a new attribute in 2010. Features can now be upgraded from one version to another. If nothing is set, the system will return version 0.0.0.0. Configuring an initial version just makes things clearer; it shows that you have made a conscious decision about it.

 

You may disagree with me on several of the points raised here, and that is fine as long as you have at lease given it some though.

Advertisements

One Response to Feature guidelines

  1. Pingback: Activate On Default | Øystein Garnes

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: