Friday, January 29, 2010

ASP.NET Controls, even the 3rd party controls are great, until you really try to use them

Over the years I have had a kind of love hate relationship with asp.net web controls and after having some frustration recently I decided to rant about it.

Conceptually it’s nice idea, the asp.net controls abstract away a lot of the “web development” so you can focus on just creating your application and not futzing around with html inputs, and creating elaborate javascript, and they give you a kind of sort of state;  and for about 90% of the time they do everything you want them to do. 

Were they fall down is really in two places:

  1. In all reality not getting that last 10% really isn’t the controls fault it’s trying to be everything to every body and you really can’t do that.  This is even true the for expensive 3rd party controls, granted vendors like DevExpress, Component One, and Telerik make some very nice controls (a lot better then the stock controls from MS) I would even say they give you an additional 5%, and for the most part they make developing web forms easier and faster, BUT they still fall down when you really push them hard and then it feels like your spending all of your time tweaking their control verses just getting your application written. 
  2. The cost of getting that statefullness by using viewstate can sometimes crush your application, like most things it’s fine in moderation, unfortunately ViewState can quickly explode in size and blot your application, creating HUGE page sizes, slow responses and if it gets big enough it starts to corrupt and your applications starts to error, fun! Once again the 3rd party vendors tend to make better controls with less viewstate.

So what is the solution, first learn about webforms controls and how they work, then create some server controls of your own.  If you look at previous posts I talk about how to create different types of controls and I’m only scratching the surface.  By rolling your own controls you can focus on getting them to do exactly what you want them to do and that might be the solution to getting the last 5% of the functionality you need.  Using Asp.net controls is one of the places where it’s really easy to get started with very little knowledge and quickly get sucked under.  This is defiantly a place where if you don’t understand how it works it can and will come back to get you. 

Finally if you can’t get that last little bit of functionality, well for the most part you just have to deal with it.  Sorry to say but we are getting to a point where the development work on the web is going beyond what the underlying technology just can support. 

No comments: