How do I follow this?

Sep 14, 2008 at 1:44 AM
This project looks interesting to the work I'm trying to do.

I'm interested in ASP.NET MVC because of the URL routing features ... never liked .ASPX style programming because of the physical resource URL mapping.  Always wanted something more flexible.  Like a lot of people I think, I'm trying to figure out how to deal with the new MVC paradigm, and specifically, the lack of postback and viewstate support.  I don't mind giving them up, but I want the same rich features that standard ASP.NET server control-based apps have, so how to get that?  I did some web searching on ASP.NET MVC and grid controls, and came across ExtJS, which I had never heard of.  I looked on the ExtJS site, and it looked really cool, so I started doing more searching on how to combine ExtJS with MVC, and alas, I landed on this project.

I managed to download it and get the sample app working with MVC Preview 5 (after changing some assembly referencing and editing the Web.config file).  Overall, it looks like a nice way of programming.  This is a lot closer to the ideal kind of web programming that I've always wanted, vs. .ASPX.  So I'm intrigued.

My problem at this point is two-fold:

1) I looked through the source code, but dang!!  I consider myself to be pretty darn good at .NET programming, but I just don't have the knowledge to follow what the hell is going on here.  I'm very weak on JavaScript, unfortunately, so that doesn't help.  I'm trying to learn it better.  This project ... not a real great way to learn JavaScript.  But besides the JavaScript, I still can't follow what is happening in the C# code.  The references to .NET base classes that I've never extended before, and the method overrides ... I just can't follow the overall program flow.  I put it under a debugger and catch the flow at my breakpoints, but it's going to be a lot of work for me to get fluent at this.  Is there any kind of primer you have that can help me out?

2) Because I don't understand how it works, I don't really know how to do anything "real" beyond what the sample app demonstrates.

Suggestions on where to start with this?

Thanks.
- Kevin
Coordinator
Sep 15, 2008 at 3:34 PM
Edited Sep 15, 2008 at 3:36 PM
Thanks for your interest in the project. So are you more interested in using a server-control based javascript library to help you with a current project? Or are you interested in writing a server-control based javascript library to reuse for forseeable future projects?

If you fall into the first category then this project is certainly what you are looking for, but probably not ready for you. If you fall into the second category then this is a great place to start because it will be valuable no matter which framework you are using, MVC or web forms. Either way your feedback is appreciated. If you're still interested, read on and then please let me know what you think.

First, you should probably read through this post (http://developmentalmadness.blogspot.com/2008/04/abstracting-systemwebuiscriptmanager.html) to get an understanding of the abstractions which are going on in the AjaxAbstractions project and why. Once you understand that, then it will make more sense when I say that the ExtJsControlLibrary project is:
  1. concreate implementation of the abstract classes in the AjaxAbstractions project - namely the ExtJsScriptManager
  2. a base control class - ExtJsControl - which uses ExtJsScriptManager to manage the script dependencies needed by server controls which target the ExtJs javascript library
  3. a library of controls which use ExtJsControl in order to mirror the ExtJs javascript API by wrapping it up as client-enabled server controls
I started this project because a colleague introduced me to the ExtJs javascript framework. While I saw the benefits and the power of what it could do I also saw that a lot of the code samples looked similar to code I already write to wrap up my data access layer. I also noticed that many users on the MVC forum were talking about different javascript frameworks, but MVC had no AJAX support (other than writing your own javascript from scratch). I decided what was needed was a way to create server controls which added client-side functionality and behavior that was reusable. I also decided that in order to provide the greatest amount of benefit to the community this could not be tied to a single javascript framework.

The current state of the project is a result of these efforts. In essense what you see here is two different projects. The first project is the abstraction project which enables the second project, ExtJsControlLibrary, to work. The goal of the first project, AjaxAbstractions, was to get other developers to write control libraries for their favorite javascript framework and add them to the project. The ExtJsControlLibrary project started as both a sample control library as well as an attempt to meet my own needs for a control library for my favorite javascript framework. The sample web projects included with the source code are currently considered proof of concept projects and test projects to make sure what I am doing works and to make sure everything remains compatible with both the MVC model and the web forms model.

The good news is that the AjaxAbstractions project is in-line with the direction the Microsoft MVC team is headed (http://www.codeplex.com/ajaxmvc/Thread/View.aspx?ThreadId=30210) and any work done here will continue to be of value to the community in the long run. The bad news is the ExtJsControlLibrary isn't complete. Beyond the few controls you see in the sample web applications included with the source code there hasn't been any more work done. The reason is because I'm still trying to get my team on board with MVC for new projects. Until I do, I have to balance the time spent on completing ExtJsControlLibrary between other side projects I am working on.

I have put a bit of effort into marketing this project to entice other developers to join my efforts, which is how you probably found it. If I am successful in building a team we could possibly see a completed control library by the time MVC goes RTM.

Your questions indicate to me that I need to provide some documentation and a better description of the goals of this project. I might even need to split the projects up into separate releases (the source code would still be part of the same project) if it will encourage the understanding of the goals here and get more developers interested in the project based on how they want to take advantage of it.

Sep 15, 2008 at 4:24 PM
Thanks for the response.  That does give me a bit more of a direction to go on.  Also, I started reading through the ExtJsControlLibrary more over the weekend, and I'm starting to understand it a little bit better.  I'm curious, why didn't you use reflection to do the JavaScript generation, instead of hard-coding in the property strings into each control class?  I see a lot of repeated code.  If you used reflection (or even if you didn't) it seems like you could bubble some of that code up to the base class.  Were there some performance concerns that stopped you from reflecting?

To answer your question, I think I'm in a little bit of both camps you mentioned.  I have several projects I'm working on, one is a commercial build management system (BuildBeat).  Another is a web site I've started recently focused on Team Foundation Server (http://www.tfslabs.com).  About 18 months ago my distaste for standard ASPX programming prompted me to write my own mini-framework, which I internally named WebXml.  There are some similarities between it and MVC, but it's not nearly as comprehensive as MVC.  It does have URL routing, however, and a form of master pages (I didn't know about ASP.NET 2.0 master pages when I wrote it).  So it was natural for me to start TFSLabs with WebXml, because I know how it works, but I'd like to switch TFSLabs over to using MVC.  I want to learn MVC, and TFSLabs would be a good vehicle for that.

TFSLabs is simple enough that I can do it without Ajax or JavaScript.  But since this is a vehicle for learning MVC, I'd like to add some fancier stuff to it.  I want to figure out a consistent way of handling client/server handshaking wrt to server controls, especially since page lifecycle and viewstate are gone.  I guess I'm looking for the new set of patterns.  When it comes time to do a real web app with a rich end-user experience, and I need some really sophisticated stuff like gridding and charting, how am I going to do that?  It seems to me like gridding and charting are the hardest things to implement, so why not start with something simpler, like some menus and tab controls.  Learn to walk before you run kind of thing.

Since I've started down this path, I see there are a bazillion JavaScript libraries, none of which I've ever heard of.  I see things like jQuery and YUI.  People like Scott Hanselman have mentioned jQuery, and thus I gather that he likes it.  Do you have any experiences with those.  I definitely feel like I'm drinking out of a firehose right now and it's making me a little scatter brained.