Tuesday, October 07, 2008
Posted on Tuesday, October 07, 2008 7:05:49 AM (Mountain Daylight Time, UTC-06:00)  Comments [6] | 
Categories: .NET | Agile | Ajax | ASP.NET MVC | Dojo

1028209_man_thinking With the recent announcement that jQuery will ship with ASP.NET MVC and Visual Studio, the question of what javascript framework to use just got more complex.

Here's my situation:

1) I need to work with the ESRI Javascript API for the maps in my apps, and this is based on the dojo toolkit

2) I want to work with ASP.NET MVC because it's actually a sane way to built RESTful web apps on the Microsoft platform.

3) I need to send complex data between client and server as json

4) I work in an agile manner, so I need an environment that's flexible - hand coding of client-side "data classes" is a waste of time if they can be generated.

So - what to do?

jQuery is awesome, but if I already have dojo loaded into the browser for the map controls, it does not add much to the mix (besides more bytes to download!)

MSAjax and ASP.NET JSON Web Services make sending complex data across the wire super simple, but should I drag along this library just to save some effort here and there? Sending complex data is possible with dojo, but it requires coding the Json deserialization on the server, which is tedious but not that difficult.

So - what to do?  My initial thinking goes like this - for apps that use Google Maps or Virtual Earth, I'm inclined to use just jQuery. If I need to send complex data across the wire, then adding MSAjax into the mix is likely worth it. For sites using the ESRI Javascript API, I'm torn. Dojo has to be loaded, so I don't see good reason to load up jQuery as well. Again the call on MSAjax will be based on the complexity of the data services.

If you are working with this stack, I'd love to hear your thoughts on this...

Tuesday, October 07, 2008 8:40:19 AM (Mountain Daylight Time, UTC-06:00)
Hi,

I've been using JQuery, Dojo and YUI for a year and I have a habit like you as

- Dojo is used for ESRI Javascript Framework
- YUI is used for ESRI JS Ext. for Google Maps
- JQuery is also used for ESRI JS Ext. for Google Maps but with condition that if there is a bandwidth limits with simple apps.

If you ask which framework do you prefer? I will choose "YUI" due to its ready components and well documentation :)

Alper.
Wednesday, October 08, 2008 7:05:50 AM (Mountain Daylight Time, UTC-06:00)
You could use JSON.NET to deserialize your objects.
http://james.newtonking.com/pages/json-net.aspx
Friday, October 10, 2008 12:08:12 AM (Mountain Daylight Time, UTC-06:00)
There is no easy answer, but I'd say you should focus on getting *really good at one library.

Yeah, jQuery may add a bit of extra weight, but it's tiny when compared with the load that is put on the browser by most modern mapping applications. And when you consume it from Google (http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js), the cost isn't minimal.

I've been using jQuery with the Ext extensions in *all of my applications for about a year now, and just about everyday I come up with a new way to improve the efficiency of my applications. I would never be able to analyze and improve my applications like this if I was jumping from library to library, and when I look at what these libraries add to the application, I stop second-guessing my decision to "over utilize" JavaScript.

That said, there are, of course, always reasons to use a particular library (ESRI's Javascript API tied to Dojo, etc.). All I can say is that you should try to avoid these situations, if possible ;-).
Monday, October 13, 2008 1:07:07 AM (Mountain Daylight Time, UTC-06:00)
Nice informative post,
thanks
Gis@SBL
Photogrammetry & Lidar Mapping
Monday, October 20, 2008 11:48:06 AM (Mountain Daylight Time, UTC-06:00)
Nate-did you mean the cost of jQuery "is minimal" or "isn't minimal"? You seemed to be arguing in the sentence that using Jquery added minimal. Thanks! These posts are very helpful. Trying to offer mapping solutions to dept. here.
Dave
Wednesday, October 22, 2008 4:39:23 PM (Mountain Daylight Time, UTC-06:00)
Sorry. Minimal. It should read:

"And when you consume it from Google (http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js), the cost is minimal."

I was trying to make the point that jQuery is 15kb minified and gzipped, so it is a tiny library that really gives you a lot.
Comments are closed.