Skip to content

How Best Are Your Best Practices

In my work with Andrew Connell on the Web Casts for Paul Andrew, we’ve been struggling to make sure that what we’re delivering in the web casts and in the hands on labs that will accompany them represents state of the art best practices. It surfaces in tons of little ways. For instance, you should always dispose SPSite and SPWeb objects you create yourself (and not those you get from SPContext.Current) so the sample code has using statements in it to make sure that the objects are properly disposed. We’ve also religiously defended against the possibility of using Render() or RenderContents() in a web part as dozens of demos have done. Why? Well, because there’s a consensus around using CreateChildControls(). The reasons are somewhat simple – because ASP.NET can work with CreateChildControls() to change the display for alternate devices (via ControlAdapters), post back values and event firing works, etc. Basically it’s a well behaved member of the family where as render and render contents are more ASP-Classic in their approach where you just write whatever you want.

Those are some of the easier ones to put a stake in the ground on. They’ve got clear cut advantages, disadvantages, and enough people willing to stand up for them. There are more subtle things that we’ve been defending as well. Things like building web parts instead of web pages in SharePoint – because the platform is about modular, reusable UIs. However, my point here isn’t to enumerate all of the things that I think are – or should be best practices. The point is that I think there’s a natural problem that we have in the industry that everyone needs to help solve. (Yes, I mean you reading this right now.)

First, let me quote James Bach who was speaking about software development methodologies “There is no consensus about what practices are best, unless consensus means ‘people I respect also say they like it.'” I believe our situation with SharePoint is not all that different. We’ve got a handful (or more) opinions about what a best practice is but little consensus on what the best practice is. I think that this is because that there isn’t one perfect answer. There isn’t in anything else either. We have suspension bridges, cable-stayed bridges, arch bridges, etc. Not one kind of bridge fits all. They each have different benefits. So while I can pretty definitively call out CreateChildControls() as a best practice, I find it much harder to persuade Todd Bleeker that my configuration based approach to loading user controls is better than his integrated project approach. I think that both can be best practices in the space. (I know I haven’t defined the details of the approach, ignore that for now, it’s not important to this discussion.)

Help Your SharePoint User

However, there’s another problem – one that in my opinion is much more insidious. There’s a large gap between the State of the Art and in the State of the Industry. In other words, we know what to do but we don’t do it. I’ve been talking about this problem in the software development space for a long time. However, I think that the problem might actually be worse in the SharePoint space. A buddy of mine, Shane Young, recently posted a blog entry — What makes a “good” SharePoint Consultant. One of the things he is saying without directly saying is that he gets called in, like I do, to clean up a ton of messes that some SharePoint consultants are creating because – in this case – they don’t know what the product can do out of the box. I wish I could make as bold of statements as Shane can about needing to know a lot about SharePoint before doing any work on the platform. I can’t because it seems like I am still learning something new about SharePoint every week – given the amount of experience I’ve got, the problems I’ve solved, and the solutions I’ve created – that shouldn’t be the case but it is. I say shouldn’t because at some point you should know everything about a system. However, I’m realizing that it’s bigger than any one person (or team of people) can experience.

Back to my point, there’s a large gap between what we know to do and what we actually do. Ben Curry just posted a blog entry about quick performance tips for SharePoint. Most of us know that these are best practices, but how many of us do them when we setup a new server? My observation is very few. Ben and Bill have gathered a whole set of these Best Practices into a book Microsoft Office SharePoint Server 2007 Best Practices that will be out soon. Will their best practices be the best practices – or merely a best practice? I suspect a bit of both. However, knowing what to do as someone might after reading the book is only half the battle. When are we going to actually do what we say?

Need another example? How about the SharePoint Governance Checklist guide that Joel Oleson distilled from my SharePoint Governance articles (Part 1 and Part 2) and then added some additional content to? How many take the 20 minutes it takes to get through this content and answer the important questions that are raised? In my observation, very few folks – even those that know about the materials – actually take the time to ask the questions and figure out the answers before implementing SharePoint.

Another thing (besides Ben and Bill’s book that’s focused on infrastructure) that may help drive us to the right place is the work that the Patterns and Practices team at Microsoft is embarking on now. Glenn Block posted on his blog that they’re looking for feedback. They’re trying to understand how people develop with SharePoint so they can provide some direction. They’ve put together a survey to try to get that feedback.

My only hope is that we can all settle on a set of best practices and actually start to use them.

No comment yet, add your voice below!


Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this: