First time here? You are looking at the most recent posts. You may also want to check out older archives or the tag cloud. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS. Thank you for visiting! (hide this)

June 2009 Blog Posts

Two frameworks are better than one

Looking deeper into the raw data of the survey about Ajax adoption among .NET developers I found some interesting figures that show a probably different mindset you get when you start working with ASP.NET MVC.

Let’s see the following table, that show the percentage of developers that use jQuery vs the MS Ajax Stack based on which web UI framework they are using.


MVC only

WebForms only


jQuery 83% 60% 90%
ASP.NET Ajax 13% 46% 13%
ACT 11% 65% 16%

Let me try to understand what a possible story behind that numbers might be:

John Developer, was working with WebForms, and was using mainly the Ajax Control Toolkit and sometimes ASP.NET Ajax. Then John read about ASP.NET MVC and started using it. He also discovered jQuery, and used it to write the Ajax part of his applications, also together with ASP.NET Ajax and the ACT. After a few happy month of ASP.NET MVC, he had to go back to WebForms development, but instead of sticking to ASP.NET Ajax and the ACT, he started using the new tools and concepts he discovered during the previous month. And that includes jQuery.

The interesting figure here is that developers that use both ASP.NET MVC and WebForms acquire a mindset that make them choose the better tool for each task, instead of sticking only to the same “hammer”. The use jQuery, but also use the Ajax Control Toolkit when it’s needed to. And I guess this not only applies to javascript frameworks, but also to the other concepts, patterns and principles.

And that is another point in favor to learning ASP.NET MVC if you haven’t already, and, if for some kind of imposition from someone higher in the management stair, you can’t use it in real project, apply the concept you learnt back to your webforms development.

What do you think? Am I drawing the correct conclusions from these figures?

Ajax survey 2009: jQuery and MS Ajax are almost tied among .NET developers

Almost one month ago I created a survey in order to try and understand how .NET developers are using Ajax. And also to compare it with the results I collected at the end of 2007.

I left the survey running a few weeks and once I received around 2500 responses I closed it: but without further ado let’s have a look at the results, and later I’ll do a more in depth analysis of the data collected.

The results

top10_JS_frameworks The most used Ajax/JS library among .NET developers is jQuery, which is used by the 71,4% of the users. Second comes the Ajax Control Toolkit with 58,8%, followed by the core ASP.NET Ajax library, which is used by 44,8%.

The 3 most used libraries are still the same of 2007, just with the opposite order (it was ASP.NET Ajax, the Control Toolkit and then jQuery).

Looking at the results of the question about which Web framework you are using, the results shows that quite a few users are starting to adopt ASP.NET MVC for building they applications: 87% are using WebForms and 32% are using ASP.NET MVC.

The other interesting question was about the adoption of the technology, and 77% of the developer that responded say they are using it in production, 70% in development stage, but is astonishing to me is that 8,3% is not using it at all, or just using in personal tests, not related to their jobs. This looks more astonishing since 2 years ago this percentage was lower (it was just 5%).

ASP.NET Ajax and the Ajax Control Toolkit

Time for more analysis: it seems strange to me that there are more people claiming they are using the control toolkit and not using ASP.NET Ajax (probably some didn’t realize one is just an abstraction over the other), so I digged into the results a bit more and I found out that the percentage of people that are using either ASP.NET Ajax or the Ajax Control Toolkit is 73% of the population. This means that jQuery and the Microsoft Ajax stack are pretty much on the same market share: 71% of jQuery vs 73% of MS Ajax.

What changed since 2007?

As you saw in the previous sections, not much: jQuery gained a lot of attention (probably due to the official endorsement of Microsoft) and all the rest remained pretty much the same. Some libraries gained a few points, like JSON.NET, and others, like Prototype and, lost a few. And, despite becoming a dormant project, AJAX.NET Professional lost only 3% of the users.


The first chart from the left (click to enlarge) shows the big gain of jQuery (in blue), the slight increase in the Ajax Control Toolkit (red) and the drop in the usage of the core ASP.NET Ajax library (in green). All of this combined lead to final result of having jQuery and the Ajax Microsoft stack with more or less the same usage (second image from the left).

top10_JS_frameworks_comparison_chart  jQuery_vs_ASPNETAJAX_chart

WebForms vs ASP.NET MVC users

Which library is preferred by developers using WebForms? And which by developers that use ASP.NET MVC?

Nothing new here: the 804 developers that checked ASP.NET MVC prefer jQuery (88%) over MS Ajax (17%) while the 907 developers that use only WebForms slightly prefer Ajax Control Toolkit over jQuery (65% vs 59%).

An interesting stat is about the developers that checked both WebForms and ASP.NET MVC: among these all-round developers the market share of jQuery is even higher: 90%, compared to the 16% of the MS Ajax stack.

Commercial 3rd party libraries

And seems like commercial libraries are starting to gain their space among .NET developers, showing a cumulative 7% gain, going from 20% to 27%: which means that 1 developer out of 4 is using a commercial library. The top spot is held by Telerik with 15,6%, followed by Infragistics with 3,9%. A company that gained a lot of market is DevExpress, which went from 0,7% of 2007 to 3,7%.

Partial rendering vs client library

The last question was about how people are using MS ASP.NET Ajax:

Option Response %
Partial Rendering /Update Panel 88%
Ajax library + services (JSON or XML) 54%
AJAH (Async Javascript and Html) 36%

Compared to the previous survey nothing changed: the partial rendering trick is still the preferred way of using MS ASP.NET Ajax, even if the percentage felt down a bit (92% to 88%). Another proof of the goodness of this approach is that 1/3rd of the developers have server-side code that directly returns HTML code. And I guess this approach is even more popular with jQuery + ASP.NET MVC where you can easily return a Partial View from you actions and have the Ajax helpers inject it into your views.

Some final random thoughts

17 people (0,7%) responded they don’t use any web UI library: they just plain HTML + JS and Handlers/WCF services on the server. And this approach is even more used than ASP Classic, which is used by only 7 developers 0,3%.

It is pretty impressive that 8,6% of the people that took the survey are still doing Ajax calls manually, without relying on library to ease the development.

The audience

Someone claimed that all the surveys not held by a 3rd party company specialized in interviews are irrelevant since someone else can cheat in order to gain more percentage points. And also because being a non randomly selected audience, it might be biased toward my readers.

Unfortunately I cannot do anything about companies asking its users to vote for them, but I tried to get the wider possible audience. At the end the survey has been linked by Bertrand Le Roy, Scott Hanselman (via twitter), Craig Shoemaker, Brad Abrams, Keyvan Nayyeri, my Italian blog and Pietro Brambati blog (DE in Italy). All these blogs have different kind of audience, and probably more “mainstream” than mine. So I hope this helped solving the bias problem.

Wait, I want more!

Which percentage of developers is using the AJAH approach with ASP.NET MVC? And what about the ones that use Dojo? If you are interested in a particular report, you can either ask in the comments or you can download the raw data and the complete results as Excel spreadsheet (Office 2007 format).

Wrapping up

The big news is that jQuery joined the ASP.NET Ajax stack in term of usage among .NET developers and that lots of developers don’t see the Ajax Control Toolkit as being and abstraction on top of ASP.NET Ajax, and this probably shows that now the ACT is becoming a product on its own.

ASP.NET MVC is used by 32% of developers after only 2 months from the RTM.

Again, a big thank to Keyvan, Bertrand, Brad, Scott Hanselman, Craig, Pietro Brambati and all the others that posted and re-tweeted the link to the survey. And all youg guys that answered the survey: this would have not been possible you.

Now it’s your turn: what do you think about these results?

kick it on

Why is my blog even greener?

I usually don’t do political posts here, but I think what is happening in Iran deserves it. It shows us that most of the Iranian people are totally different from what the media tell us.

I’ve been following what’s happening over there with twitter, and I thought I’d show my support to the cause wearing green on blog. A lot of other sites are doing it ( put a green t-shirt on his alien).

If you have a blog you can help spread some love to the guys in Iran: just add a green background to you blog.

I hope all my reader living in Iran are doing fine. And a special mention goes to Keyvan, which authored with me the book about ASP.NET MVC and Madhi, ASP.NET MVC developer. I hope you are both fine.

All Apple WWDC 09 keynote in 1 minute

For those who were not able to follow live the keynote and have not found two hours of spare time to watch the recorded stream of the WWDC, here you can fine a video that recaps in a little more than 1 minute all the important news announced during the Apple WWDC 2009 keynote. Enjoy:

WWDC 09 in 1 minute


Technorati Tags: ,,

Using Request inside Actions: why it is a bad idea

Why can’t I use Request["id"] inside an action to get the value of the query string parameter named "id"?

I was asked this questions millions of times in the talks I did about ASP.NET MVC during the last months. I also got it asked a few times from colleagues so, when yesterday a friend asked the same question on a comment on one of my latest posts, I decided that the time had come to try and clarify this with a post.

The quick answer is: “Because you don’t want to have a dependency on the environment, especially since this can be easily avoided”.

But let me explain better. Imagine you want to display a “page” given its id, and you have to process the following url:

If you use the Request object, your action method will be (NOTE: this is not the recommended way to get the value of a query string parameter):

public ActionResult Page()
    int id = Convert.ToInt32(Request["id"]);
    //do something with the id
    return View();

Or you can do it the ASP.NET MVC idiomatic way:

public ActionResult Page(int id)
    //do something with the id
    return View();

What the ASP.NET MVC framework does is automatically initializing the parameters of the action method using the values of the query string parameter with the same name.

This has two big advantages over manually reading the Request object:

  1. it automatically casts to the correct type (in the sample you have a integer) and raises an error if the parameter is of the wrong type. Additionally if the parameters is a complex type (not just string or integer) it is automatically initialized setting values for all its properties. Imagine doing this manually reading the Request object.
  2. it isolates the action method from the environment so that the it is just a normal method with some input parameters and a return value. A side effect of this separation is that you can test the action by just supplying the input values to the method, and without the need to mock the Request object.

Having said that, I admit that there are some scenarios, like when accessing the Cookies collection or when reading the raw request content, this is the only option. But unless you are doing these exotic things, the best solution is using the idiomatic way, and let the framework do all the work for you.

Hope I clarified this a bit more.