Client side code vs. server side code in SharePoint Implementations

There has been some great discussion of late in the community about client side code vs. server side code. This page will hope to summarise the opinions of the people in the community and I encourage everyone to add pros and cons and guidance to this page also (remember it's a wiki for everyone to contribute towards!).

@jthake recently did a podcast for @SPDevWiki with both @sympmarc and @willhlaw which are worth a listen around client side code.

Client side code

Client side code requires developers to have skills in a ECMAScript library such as jQuery or Microsoft AJAX. The script can be developed in any text editor and tested in any browser. Firefox has an addon for debugging called Firebug, Microsoft IE has it's built in Developer Toolbar.

Pro Con
Script can be added to the page as content and executed without compilation Reliant on User browser being compatible (or even enabled) with client side code
Can modify the UI DOM without 'hacking' at out of the box SharePoint Root files on server Reliant on User browser (PC) performance in processing client side code
Reduce the load on server by pushing work to client Can be difficult to reproduce bugs unless environments for each Broswer are available as can produce different results in each
Can customize SharePoint without the requirement for server side code which is often blocked in some Enterprise environments There are limitations to what can be done client side compared to server side
Can enhance the UI with jQuery add on libraries such as autocomplete that are not possible with server side code Supportability when migrating to new version of UI (relies on DOM objects being the same)
Since script is stored in content DB, you can use same backup and restore solutions as well as same server to server farm replication solution for content and code.  

Good examples of use

  • Reducing the page postbacks due to how server side object events work by replacing them with client side object events

Server side code

Server side code requires developers to have skills in ASP.NET 2.0 and either C# or VB.NET within Visual Studio.

Pro Con
Rendering is done server side ensuring the same results on all browsers Requires compilation and redeployment of Solution Packages (WSPs) when code changes which can delay results being delievered in Production
Rendering performance can be controlled as Organisation manages the server infrastructure  

Good examples of use

  • Rendering large complex datasets to the screen separating data from presentation using XSLT on the server side

External References

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jan 02, 2010

    Mike Oryszak says:

    I use jQuery and have written and presented about its use.  I tend to use i...

    I use jQuery and have written and presented about its use.  I tend to use it for one-offs and small customizations where I do not want to maintain a code base and solutions.  For a full blown project or application I'm already generating code so I'll lean towards server side for most processing and use client side selectively where needed.  As @eshupps mentioned, performance does need to be considered, though my experience with performance has been pretty positive.

    To some degree I see this along the lines of SharePoint Designer Workflows versus .NET Workflows.  You pick the tool that makes sense for the job at hand.  There are limitations to the one, but the project/build overhead of the other is higher and not always justified.

  2. Jun 01

    Christophe Humbert says:

    Please allow me to disagree with some of the above statements: Server side code...

    Please allow me to disagree with some of the above statements:

    Server side code Pro: Rendering is done server side ensuring the same results on all browsers This is definitely not true. Look for example at a SP2007 Gantt chart in IE and FF and you'll see the difference. Server side code is also dependent on browser issues. So the statement under client side code "Can be difficult to reproduce bugs unless environments for each Broswer are available as can produce different results in each" also applies to server side code.

    There are limitations to what can be done client side compared to server side well, the opposite is also true. For example working offline is a new trend in Web application that is supported by client side code. Also some user interaction (autocomplete, simulations, interactive charts) is far easier to manage on the client side.


Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. Hosted generously by CustomWare