Friday, June 24, 2011

SharePoint 2010: Ajax and Silverlight and others


Here is the highlight from the book Designing Solutions for Microsoft SharePoint 2010: Making the right architecture and implementation decisions (Patterns & Practices)  about using the rich client in SharePoint 2010:


[What you have]:


You have a project that requires to build a rich client on  SharePoint 2010. 

[What you want]:

You want to understand which new RIA (rich internet application) capabilities of SharePoint 2010 suite you the best: Ajax or Silverlight or others? Are there others?
 
[What you want to know]:

Typically, there are three main reasons for developing client-side logic that interacts with a SharePoint enviroment:
  - You want to provide a richer user experience on a SharePoint Web page;
  - You want to perform actions that are unavailable to server-side code running in the sandbox environment, such as accessing information from multiple site collections or retrieving data from an external service.
  - You want to access and manipulate SharePoint data from another application, such as an Office client application or a custom solution.

Decision-making "How to build a rich client" includes 2 main area:

"Data Access".
Options are:
 - client-side object model (CSOM);
 - REST interfaceASP.Net Web services;
 -  BCS ( as a specific example - using BDC object model). Please refer to SharePoint 2010: BCS and BDC  to understand the relationship between BDC and BCS

"User experience"
 - Ajax;
 - Silverlight;
 - Office client applications;
 -  Stand-alone clients built on WPF, Windows Form applications, a console application or PowerShell extension (PowerShell and SharePoint: What, Why and How )







Here are some considerations regarding what type of rich client is more appropriate:

If RIA app requires substantial computation on the client, prefer Silverlight over Ajax. The untyped nature of javascript will bring the performance down in this case.

Please keep in mind that Ajax in Internet world much wider accepted than Silverlight. If you have decided to build a Silverlight solution, the best practice is to provide  alternative HTML content within the object tag.

Generally speaking, there is a trade-off between reach and capabilities. Pure HTML has universal reach but limited capabilities. Ajax brings richer functionality but  may not be supported by every browser. Finally, Silverlight and Flash provide the broadest set of capabilities but only work if the user installs the plug-in.

Pages that contain Ajax and Silverlight functionality will typically have a higher initial load time than traditional thin client approaches. However, as asynchronous communication model ensures that the page remains more responsive.

Caching strategies, delayed\predictive loading; "minifying" javascript libraries (Microsoft Ajax Minifier)
improve the load time.
To get more sustain knowledge regarding this techniques  refer to RIA Technologies: Benefits, Tradeoffs, and Considerations

 Cross-domain access is possible!

In order for a Silverlight application to access services on a different domain, the external domain must include a client access policy file at the root of the web site (What's New: Silverlight Integration and Cross-Domain Data Access)

Cross-domain access from JavaScript is more complex but is possible under some circumstances (Cross-Origin Resource Sharing)



[What you want to consider]: 

Refer to msdn - Client Application Models in SharePoint 2010


Buy a book to get deeper knowledge of pros and cons of rich client application development on SharePoint 2010: Designing Solutions for Microsoft SharePoint 2010: Making the right architecture and implementation decisions (Patterns & Practices) Part III

 Read a free extra from the book  - refer to Part 3 Chapter 8.

 Take a look at The Client Reference Implementation.