Friday, August 24, 2007

SharePoint Applications – Design Lessons Learned (so far)

I can't believe that it has been 18 months since my last blog entry. The main reason for this absence is that I've been busy designing and implementing MOSS enterprise projects since June 2006 and, like they say, time flies when you are having fun (well sort of). I've decided to return mainly because I needed to create a list of "tricks" and lessons learned as a "reminder to self" so that I can apply them in future projects. If I can help other people on the way then even better.

In this blog post I'm going to highlight some of the design and architecture lessons that I've learned so far. In future posts I'll be drilling down in some of the areas and present concrete examples.

So here is my list so far:

  1. Do not forget standard/proven design and architecture patterns just because you are using SharePoint. SharePoint should be seen as another layer in your technology stack that your code will interact with. But just because you are using this layer you should not forget to follow good and proven design practices. The following points describe some of the principles that sometimes seem to be forgotten when using SharePoint.
    1. Create a data access layer to access your lists. After all you would be doing this if you were programming against a database table so why not do the same for a SharePoint list. The last thing you want is to have several components of your application accessing the same list in several different ways. If the list schema, name or location changes then you would need to change the code in every component that uses that list (this could be acceptable for small proof of concept applications but not for enterprise applications). In a future post I'll be giving an example of designing and coding a simple SharePoint data access layer.
    2. Use SharePoint lists to store configuration data. Create a configuration site, on your site collection, containing all the configuration lists. Before SharePoint all configuration needed by you applications resided in a data store (normally a database). You then needed to build a UI to allow power users and/or administrators to change that information. You also had to implement security mechanisms to make sure that only the users with the correct permissions were allowed to change or access that data. With SharePoint you can accomplish all of that with out of the box functionality without writing a single line of code. You can also adopt the same principle for structured content. For example let's say that you want to create a very simple top navigation menu (like the one on the top right corner of this page) and allow your users to add new links or edit existing ones. You could create a TopNavs list on a "/config" site under your site collection with "Name" and "URL" columns. You could then create the menu using a simple ASP custom control and bind it to the TopNavs list. I'll be showing how to do exactly that in a future post.
    3. Do not forget about databases. Just because you are using SharePoint and have all of those nice lists that you can easily create and configure it doesn't mean that you should stop using databases (disregarding the fact that SharePoint is actually storing all of the list data on a database). You should always ask yourself the reasons why you should use a SharePoint list instead of a database table. Remember - SharePoint is a service layer - so if you are not using the services provided by that layer then perhaps you should be using a database table instead. SharePoint lists also have greater limitations than database tables (see this Microsoft document for more information on those limitations).
    4. Empower business users but try to keep them in their comfort zone. I know that this sounds like a sales cliché but it's actually one of the main SharePoint selling points. You should ear this sentence echoing in the back of your mind every time you are talking to a customer. This will help you making better decisions and keep your customers happy. Here is an example:
      1. You are responsible for the architecture and design of a brochureware site for a major financial institution. One of the main reasons for them to adopt SharePoint was to give more control to business users. You decided to base the site on the out of the box publishing site definition and you are just about to test your first content page (which is using the out of the box Rich HTML editing control).You look at the generated html code and suddenly freeze. Your heart starts pumping faster and you cannot believe on what your eyes are telling you; the HTML code generated by the control is appalling. Your professional pride kicks in and tells you that you cannot be responsible for code like this. What do you do?
        1. Talk to the customer about the problem and suggest replacing the control with a "professional quality" third party editing control (they would need to agree the extra costs).
        2. Tell the customer that you cannot be responsible about the quality of the code generated by the control and ask them to make a decision. You can point out that, although the quality of the generated code is far from ideal, it can be a viable option as long as they are not concerned with accessibility issues.
        3. Tell the customer to continue to use the control and teach them how to improve the code by showing them the control's HTML view.

      Option 3 is the least appealing one because it will require your business users to step out of their comfort zone and learn something that they shouldn't need to for their day to day jobs (unless they are technical minded and do not mind the learning curve).


       


 

No comments: