Welcome to my blog on all things SharePoint. I have a range of articles that will interest you if you've made it as far as visiting my blog. I was awarded as an SharePoint MVP by Microsoft in July 2010. I currently live in New York and am an Enterprise Architect at AvePoint Inc.. I co founded www.NothingButSharePoint.com with Mark Miller in 2010.

MVP AwardJeremy Thake Profile Photo

Whitepapers

NBSP

Check out my articles on NothingButSharePoint.com

Solution Development in SharePoint 2007

This series was inspired by the chatter amongst SharePoint blogs on the best ways to approach customisations in SharePoint using Solutions.

Part 1 - Part 2 - Part 3 - Part 4 - Part 5 - Part 6 - Part 7 - Part 8

Leveraging the SharePoint Platform

This series was inspired by a discussion had with Andrew Coates at a Perth SharePoint User Group meeting. This then turned into a 6 part series on Arno Nell's SharePointMagazine.net web site.

Initial post - Part 1 - Part 2 - Part 3 - Part 4 - Part 5 - Part 6

Webcasts

I have recorded various web casts that I present at User Groups or just on a specific topic by request:
How ASP.NET Developers can leverage SharePoint webcast
SPSource Webcast: Reverse engineer Lists to ListTemplates and much more
SharePoint Development with Unit Testing webcast
Perth SharePoint UG Web Cast on approaches to deploying artefacts (SPSource)
More...


Podcasts

I have been interviewed about Leveraging the SharePoint Platform by the SharePoint Pod Show: listen here .

RSS Feed Feed your read!

Archives

March 2012 (1)
February 2012 (1)
January 2012 (5)
September 2011 (2)
August 2011 (1)
July 2011 (3)
June 2011 (7)
May 2011 (3)
April 2011 (3)
March 2011 (3)
February 2011 (2)
January 2011 (1)
December 2010 (4)
September 2010 (4)
July 2010 (5)
June 2010 (4)
May 2010 (6)
April 2010 (7)
March 2010 (5)
February 2010 (7)
January 2010 (3)
December 2009 (1)
November 2009 (6)
October 2009 (9)
September 2009 (7)
August 2009 (6)
July 2009 (13)
June 2009 (4)
May 2009 (12)
April 2009 (4)
March 2009 (4)
February 2009 (13)
January 2009 (4)
December 2008 (4)
November 2008 (11)
October 2008 (16)
September 2008 (4)
August 2008 (5)
July 2008 (4)
June 2008 (8)
May 2008 (5)
April 2008 (9)
March 2008 (5)
February 2008 (6)
January 2008 (1)
November 2007 (11)
October 2007 (8)
September 2007 (24)
August 2007 (5)
July 2007 (2)
May 2007 (1)
April 2007 (1)
March 2007 (1)
February 2007 (3)
January 2007 (4)
November 2006 (7)
October 2006 (7)
September 2006 (18)
August 2006 (14)
June 2006 (3)
May 2006 (8)
April 2006 (4)
March 2006 (38)
February 2006 (30)
January 2006 (2)
December 2005 (3)
November 2005 (28)
May 2005 (1)
April 2005 (5)
March 2005 (1)
November 2004 (1)
August 2004 (11)
July 2004 (1)
Failed to render control: An error occurred during a call to extension function 'createMonthUrl'. See InnerException for a complete description of the error.

Links

Tag Cloud

Ajax, Apple, DotNetNuke, Enterprise Content Management, Error Resolution, Gadgets, General, Governance, Microsoft .Net Development, Mobile, SharePoint, Sharepoint Business Forms, Sharepoint Business Intelligence, Sharepoint Collaboration, SharePoint Development, Sharepoint Enterprise Content Management, Sharepoint Enterprise Search, Sharepoint Portal, US Migration, Web 2.0, Workflow

jQuery: the SharePoint Band Aid   

Tags:

Ok, so now I've got your attention you eager beaver SharePoint End Users...Power Users...etc. I thought I'd just put a few things out there from the other side of the fence!

So there's lots of hype around jQuery and SharePoint on various resources such as EndUserSharePoint.com and some of my other personal SharePoint Developer heroes: Joel Oleson, Jan Tielens, Waldek Mastykarz, Nick Swan, Paul Grenier (aka AutoSponge) and David Kitchen. There is a great summary post on jQuery here by Vedant Kulshreshtha.

To summarise, jQuery is mainly used to make SharePoint User Interface "useable" as Mark Miller put it in Joel's comments. He does put a caveat in terms of "it having its place".

The Cons

Avoiding Development

jQuery is a serious band aid in terms of avoiding modifying the User Interface via the correct Microsoft supported approach: Solution Packges, Features, Master Pages, Page Layouts and CSS properly. If you click on a lot of the links above you'll notice most is to tweak how SharePoint renders the out of the box page elements. This can all be done by development approach as well with a lot more control around it (versioning, deployment, performance, extensibility etc.).

Upgrade Path

The benefit of modifying the User Interface via the development approach is that you are extending SharePoint's User Interface control elements rather than adding an extra layer between SharePoint's rendering and the User viewing seeing it rendered. By adding this extra layer using jQuery to hack at what would be rendered you are introducing dependencies in terms of what you expect SharePoint to render. This will become an issue when you run any service packs on the SharePoint farm because there is no guarantee that things will stay the same between version!

Losing Control - "all or nothing"

This brings me on to my next point. Most of the examples displayed encourage users to place jQuery into Content Editor Web Parts within Web Part Zones. This basically means that anyone with access to a Page can add this web part, paste in the jQuery code and save it.
In short, controlling who can and cannot add jQuery is going to be a problem. SharePoint does not have the ability out of the box to block certain code blocks such as <script> from being used within Content Editor Web Parts or any Rich Text Editor element on a page for that matter.

Breaking stuff

It is also worth pointing out that if "power users" write crap code and don't test it properly, that they will break the JavaScript for that page which could stop other scripts from loading up properly. This could cause even more useability problems. Even worse, imagine if they write recursive methods or massive loops or worse still find some code that calls the web services and puts huge load on SharePoint servers. The worst case scenarios here are endless!

Enforcing Branding

jQuery basically gives "power users" the ability to break the branding that SharePoint is meant to put back into the control of the corporation. It's one of the selling points of the Platform, and now we're encouraging them to hack around the efforts of consistency with Master Pages and Page Layouts.

Maintenance

As a scenario, imagine two years down the line when there has been multiple "power users" who have dabbled with jQuery and cut and paste stuff from all these resources out there to make their SharePoint User Interface "useable". It'll be an absolute nightmare!

The other issue with this is that the scripts are being put straight into the Content Editor Web Part. There is no versioning in these web parts and I can't see anybody trying to enforce that jQuery scripts be put in source control first by Power Users before being deployed to Production as it'll be deemed as content.

Business Logic locked in client side

I've also seen jQuery being used for Business Logic, for example, domain validation of List Item columns in forms. This again can lead to business logic being locked into client side code with no versioning or unit testing! The best way forward with regards to this is calling off to Web Services...but that would require Development. So why not do it in development in the first place?

Testability

jQuery is a client side script that is executed in the browser. The only real way to test this would be to record User Interface scripts and re-run them each time. Again, this is a huge overhead...even more so if this is done manually. To put this into perspective...how would you test it's all operational when you've completed the next SharePoint update where the user interface has changed?

Debugging

I'm actually quite shocked how jQuery has entered the mainstream like this. It wasn't that long ago that JavaScript was the devil and that it was just all so hard to debug! There are some great tools around to help you these days with this, but just bear in mind that sometimes it is a nightmare to see what is going on. So if developers aren't that happy with it (in general) how are "power users" going to cope?

Accessibility

Browsers have come along way with regards to JavaScript support and jQuery as a framework has done a great job of getting coverage across most JavaScript engines. Most Power Users who are playing with jQuery are in an Intranet environment which is typically controlled by a SOE that includes the latest update of Internet Explorer 7.0.
It is worth highlighting, for those not in this scenario to be aware that it is not going to be a reality if they have JavaScript disabled. This is especially so for Internet facing web sites where you can't control the end users browser.

The Pros

Open Source

As a framework, you can't go wrong with jQuery. It's becoming the mainstream JavaScript framework of choice across many solutions these days. I appreciate that there is a lot of buzz across the whole IT world around jQuery for numerous reasons such as Microsoft taking it up for SharePoint 14 even though its an open source  project originally created by John Resig (who currently works at Mozilla).

Easy to Use

The jQuery framework is a lot easier to read and understand compared to other frameworks out there. It is also extremely light-weight and easy to snap into a page (almost too easy).

Community

The jQuery community (see Joel's post) is growing at a huge rate because of the uptake by major platforms and also because the open source community just knows how to create buzz around products.

Web Services calls to avoid postbacks

Everyone hates ASP.NET/SharePoint Postbacks with a vengeance, the ability to refresh sections of the page without refreshing the entire screen is a godsend from a usability point of view.

 

Ok, so I'm off my soap box. But I feel that it is my duty as a member of the SharePoint community to point out the risks of jQuery in SharePoint implementations! Giving this much control to "power users" scares the sh*t out of me or as my Perth metal lover Paul Culmsee would say "leads to a wicked problem".
I'm all for "power users" to control content within the platform...I just don't see writing jQuery as something they should control!

 
Posted by  Jeremy Thake  on  2/23/2009
11  Comments  |  Trackback Url  | 1  Links to this post | Bookmark this post with:        
 

Comments


MikeBirty  commented on  Monday, February 23, 2009  3:37 AM 
You had me at hello!

When I see a JQuery tutorial its the only time I'm happy that my place doesn't really have any Sharepoint Power Users (yet!).


Christophe  commented on  Monday, February 23, 2009  6:40 AM 
Jeremy: as you know, my site offers multiple client side scripts - jQuery or not.
Your analysis is based on the statement that "This can all be done by development approach". In practice, for many jQuery supporters it is just not the case, for various reasons (hosted environment or strict company policies for example).


Thomas  commented on  Monday, February 23, 2009  7:47 AM 
Hmm...

While I agree with many of the cons, I think that SharePoint brings jQuery on itself seeing as how its really easy to just drop scripts in a CEWP and SharePoint designer SUCKS so hard.


Waldek Mastykarz  commented on  Monday, February 23, 2009  10:25 AM 
I think that it is not black or white whether to use jQuery or not. Like everything in SharePoint: when used properly it allows you to build great stuff but when misused can lead a total disaster.

Power users can write crappy code: but so can developers. As far as I'm concerned it shouldn't be a reason not to go with jQuery.

Upgrade path: I'd suppose that's one of the most issues with using client-side programming with a non-semantic markup. If SharePoint's markup was semantic it wouldn't matter whether you're on SPS, MOSS or vNext. Most of the markup would be the same and there would be some minor changes. Unfortunately the WSS team has chosen to do different. Right now we have to deal with really poor markup and building any solution on top if gives you no guarantee that it will work tomorrow when the next update shows up.

Accessibility: that one has to do with JavaScript in general, not only with jQuery. The main idea is that you should never provide functionality based on an optional technology like JavaScript. You should always provide a working alternative in case that technology is disabled. jQuery or not: as long as you're using JavaScript in an accessible web application, you have to test it with JavaScript disabled. The biggest problem is, that SharePoint relies way too much on JavaScript. So if you disable it, your custom jQuery modifications will be the least of your worries ;)

One of the most important reason to use jQuery above Plain-Old-JavaScript is the cross-browser support. There are some differences in how different browsers parse JavaScript. Unless you work with JavaScript a lot and have experience with how it all works in different browsers, you will spend hours on trying to find out why some things work in IE and don't in FF. jQuery provides you an abstraction layer: one and the same for every browser.

To wrap it up: jQuery is great for client-side development. It makes it easier and better maintainable. As with any client-side technology: you should always consider that there might be machines where it's not available and you should provide an alternative.


AutoSponge  commented on  Monday, February 23, 2009  10:59 AM 
/soapbox-on/ If governance groups handle permissions properly, jQuery should have no unforeseen impact on the implementation.

Personal views of pages, web services security, and IIS can handle anything we throw at it.

If someone has access to public views, you should EXPECT them to apply their own code to it--that's what it's there for. If you're afraid of that possibility, you need to train that user and validate their understanding of the implementation before you authorize those permission levels. You don't give a 16yo the keys to your car until they take their driver's test (and even then you only let them drive a junky car for a long time till you're comfortable with their experience and competence level).

The same thing goes for SPD, web services, and anything else you think has a risk factor for your site collection.

Plan your permissions properly and you have nothing to worry about. Educate your users and you can make them partners. Listen to your partners and respond to their needs and you can have happy users who respect you (without fearing you). /soapbox-off/


Karl Swedberg  commented on  Monday, February 23, 2009  8:14 PM 
Hi Jeremy. I enjoyed reading this unique perspective of jQuery. One thing you might want to correct in your post, though: jQuery is <em>not</em> a Google project. Its creator and lead developer is John Resig, who is currently an employee of Mozilla and never worked for Google. In fact, nobody on the <a href="http://docs.jquery.com/Contributors">jQuery project team</a> works for Google.

Thanks


Karl Swedberg  commented on  Monday, February 23, 2009  8:48 PM 
Hi Jeremy. I enjoyed reading this unique perspective of jQuery. One thing you might want to correct in your post, though: jQuery is <em>not</em> a Google project. Its creator and lead developer is John Resig, who is currently an employee of Mozilla and never worked for Google. In fact, nobody on the <a href="http://docs.jquery.com/Contributors">jQuery project team</a> works for Google.

Thanks


Karl Swedberg  commented on  Tuesday, February 24, 2009  9:53 AM 
Thanks for correcting the post. Unfortunately, since you didn't also note the update, my comment (err, comments -- sorry about that double post)


Christophe  commented on  Wednesday, February 25, 2009  6:51 PM 
Actually, I could also add that some of the client side stuff I do cannot be done on the server side.
The model I have described in this post is a real life scenario:
http://pathtosharepoint.wordpress.com/2009/02/15/a-content-editor-web-part-for-every-home/
I often find myself in situations where teams from different origins become partner on a project. They have their respective SharePoint environment, that they temporarily share. A CEWP will allow me to apply branding and navigation across servers for the duration of the project.


John Bailo  commented on  Tuesday, March 31, 2009  2:46 PM 
I'm glad it's supported. JQuery makes menuing easy. I also like using it "in the raw" on LAMP.


Dan Johnston  commented on  Thursday, April 16, 2009  6:51 AM 
Great reading, good to see some best practice thoughts on this subject. I would argue that any user with design permissions has more than enough power to break your site regardless of an embeded jQuery link. Also, many of the tried and tested SharePoint functionality already requires javascript to be enabled.

Sadly not all organisations have proper staging/testing environments in place, yet wish to utilise sharepoints front end to leverage line of business data. Improving the client front and utilising frameworks such as jQuery is really helping achieve this.

blog comments powered by Disqus