I was in a customer meeting the other day helping evaluate one of their SharePoint sites that seemed to be running slowly (3-5 second response time instead of 1-2 second response time). I asked about customizations that were done to the site when the customer said the following (to paraphrase): “Yes – we built and installed four custom solutions, and there have been no performance code reviews on the custom code.” No performance testing? Or code reviews? This is one of the many mistakes I’ve seen when it comes to custom solutions built on top of SharePoint. Here’s why:
If you’re looking to build a business solution with SharePoint, you have two choices: color within the lines or color outside the lines. What do I mean?
Coloring “Inside the lines”
SharePoint does so many things out of the box (that are relatively easy to configure) that it’s easy to get spoiled. For example, I can provision a website, add permissions, add several custom data lists, drop in some out-of-box UI elements (web parts), add an aggregation (via the content query web part), configure a customized workflow, and show some KPIs (key performance indicators) all without any code. In fact, I may be able to complete my solution without any custom code at all. Wow – that was fast. And since all I did was some customization using out-of-box tools, I can get away with cursory testing.
But hold on.
Coloring “Outside the lines”
The minute I recognize that my SharePoint-based solution needs an element that is not out-of-box, I may need to write some code. Let’s say that customization gets me to 90% of my solution. That’s okay, since I’m only having to build 10% of my solution (instead of 100%). But as soon as I cross this line, I need to recognize that custom code requires a certain level of discipline that customization simply does not. What does it require? Things like:
- Performance testing (does my code introduce performance issues?)
- Code reviews (is the code documented well? is it written well? will it upgrade?)
- Best practices (is the code checked into source control? are all bugs eliminated?)
- Proper need (did I write code that I didn’t have to? is there an ISV solution to close the gap?)
- Proper architecture (did I use the object model correctly? should I use a particular feature that I neglected to use?)
Keep these items in mind when attempting any custom code with SharePoint. Custom code is a good thing — just make sure that when you cross the line from customization to code, you do it in the proper fashion.
Here are some important resources regarding best practices with SharePoint, including the recent update to the Patterns & Practices guidance on MSDN. In fact, check out the code acceptance checklist. How many of these do you check before deploying your code? Be honest!