Wednesday, December 10, 2008

To dispose or not dispose, that is the question...

Most SharePoint developers now know the importance of disposing SPSite and SPWeb objects.

Most of this information are not coming from the SDK but are trickling out by Microsoft employees, mainly from Roger Lamb and Stefan Goßner blogs.

Stefan's latest post is a very good and should be required reading

However, the advice and guidance keep changing and being amended.

This means developers need to make sure they are keeping up with the latest information.

For example, at one stage we were told to dispose the SPWeb object after calling SPSite.Owner. Now we should no longer do that.

This is not an ideal since it will require another review of your code.

Also, are these blogs to be viewed as official guidance from Microsoft?

For example, the newly released "Patterns and Guidance" links to Rogers blog.

We are almost two years into the product lifecycle and we are still learning best practice when it comes to writing memory efficient code.

For the next version of SharePoint it would be a lot better for this information to be provided in the SDK from day one.

Also, don't get me wrong!

I think Roger's and Stefan's contributions are fantastic.
Everyone really appreciate the work they are doing.

For the time being, make sure you subscribe to Roger's and Stefan's blogs!

No comments: