SPHello.World()

A SharePoint Kata? What’s that? Well, it all goes back to Coding Katas – an idea based on martial arts where we try to regularly hone and improve our coding skills with specific exercises. For more information, and more links, see the About page on this site.

When it comes to SharePoint, the goal is to propose and discuss Katas to improve our skills in this domain. However, they’re not just for developers – administrators and even users can benefit from doing some regular activities. Here are some possible benefits:

  1. Improving, refining and honing existing skills, so we get better at what we do already
  2. Repeating Katas over time, so we don’t forget something we did and knew in the past
  3. Learning new SharePoint skills as we get to try a small (e.g. 30 minute) task focused on something we haven’t done before.

Some of the best Katas are those done in pairs! The goal of this site is to help us improve, share, discuss and learn together, so get involved by suggesting your own Katas, commenting on the ones here already, and helping to build some real SharePoint Ninjas!

 

TypeMock Isolator for SharePoint Discount

One of the common techniques with Coding Katas is doing Test Driven Development (TDD), or at least having a good suite of Unit Tests for your code. Unit Testing with SharePoint is quite a bit more tricky though because of the dependence on the SharePoint libraries and runtime. This is where a product like TypeMock Isolator for SharePoint comes in to play. I recently interviewed Roy Osherove (see Unit Testing With Roy Osherove), noted Unit Testing expert for The MOSS Show and as a follow up, TypeMock are offering a discount on the SharePoint Isolator product. To take up the discount, listen to the intro to the most recent show (ISV Overview #1 – BA-Insight) for the discount code.

As I mentioned in the show intro, also on offer are a couple of free licenses for TypeMock Isolator – all you have to do is write in to the show with a great letter. The best letters will be read out in the show (you’ll be famous, too!) and will win a license.

 

SharePoint Dev Kata 2 – Working With Resource Files

One of the practices I’m trying to improve on in my teams is working with string literals. In Feature XML files, for instance, we can set the DisplayName of a Site Column to pull from a localized resource file instead of being hard-coded. See here for an introduction by Ton Stegeman. In addition to being able to localize the values, the resource file creates a strongly-typed “code behind”, if you like, which is a wrapper resource manager to allow you to access the values from code directly. This Kata is about practicing the pieces of this.

Here are the steps:

  1. Create a new Feature called “Testing Resources Feature”
  2. Add a Site Column called “My Test Column”
  3. Add a Resource file
  4. Create entries in the Resource File for these two strings
  5. Use the strings in the Feature and Site Columns xml files
  6. Modify the Site Column’s “Name” property to also use a Resource setting
  7. Create a new list definition in the Feature to use the new Site Column
  8. Add an item to the list in the Feature Receiver and use the strongly-typed Resource key to access the field
 

SharePoint Admin Kata 1 – Add FBA

Yesterday we had a developer Kata, so today I thought I’d kick off with one for the administrators. In this Kata, start with (or create) a site collection running with regular Windows authentication, then we’ll go ahead and add a Forms-Based Authentication zone. This will gives us practice in FBA, Alternate Access Mappings (AAMs) and Zones.

One note – for these administration Katas you’ll be working with a running instance of SharePoint. PLEASE don’t do these exercises on your live installation ;->

Here are the steps:

  1. Set up the Forms Based Authentication infrastructure (database, config changes, etc.)
  2. Extend the web application to a new URL (http://Intranet.MyCompany.Com)
  3. Configure the new web application’s security zone to use the FBA settings
  4. Create a hosts file entry on the machine to point to the new site, and test on the server
  5. Repeat step 4, this time on your workstation

If you haven’t worked with FBA before, here’s a video on How Do I: Add Forms-Based to an existing Windows Authentication Site?

 

SharePoint Dev Kata 1 – Add a Contacts List

And now for the first Kata! It’s a developer one, to kick us off. In this Kata, we’re going to look at a few different ways to do the same thing. It’s just a simple one to get us into the swing of things, and compare how the approaches differ. The goal is to create a Contact list using out of box template.

Here are the steps:

  1. Create a new Contacts List using the UI. Call it “Contacts UI”.
  2. Don’t put it on the quick launch
  3. Add a new field called “Extra Email Address”
  4. Add a new contact
  5. Repeat the steps, this time with a Feature. Call the list “Contacts Feature”
  6. Repeat the steps, this time via the API (write a Visual Studio Test project, or whatever your favorite testing framework is). Call the list “Contacts API”
  7. Repeat the steps, this time via the Web Services. Call the list “Contacts WebService”

The goals of the Kata are to get familiar with the different approaches and APIs and to compare and contrast them. Consider the benefits and drawbacks of each one. Also, give some comments on this page.