AJAX and MVC


I have been developing an online time tracking app that will allow employees to input their time on a per-client bases. Rather than filling out a full time card, the employee will only enter time per project or client. Its a little bit more cumbersome for the employee but it makes it easier on the back end for accounting to get billing right.

Since the company I am working is an all Microsoft shop I am developing in C#. But rather than using the vanilla Microsoft controls and assemblies, I decided to harken back to my Java roots and use a Model View Controller framework for the app. If you have been reading my earlier posts (which few people do), you will notice that I have been raving about Mavnet, a C# based MVC framework based on Maverick for Java.

Development thus far has been very similar to my Java days, but I decided to throw in a twist, I wanted to encorporate some sort of AJAX elements into the app. I am using a lightweight AJAX wrapper called SACK, it saves alot upfront legwork to get things set up and running.

The main AJAX element of the app comes in when the employee submits their timeslip, rather than the whole page submitting, just the form value are sent to a waiting Mavnet Throwaway form. My biggest surprise came when (and maybe everyone else knew this and I am just slow to pick it up) came when I was debugging the server side calls and I realized that all my form objects were populated with the values from the form. The reflection worked with the Javascript XMLHttpRequest calls! This was more than I could have hoped for! Now rather than having to manually get all the parameters out of the request, I just had to make sure they were named the same between the html form and C# form object.

  1. #1 by mikepk on January 23, 2006 - 12:02 pm

    This comment may seem a little ‘spam-y’ but I’m trying to generate some discussion on something I’ve developed.

    I’ve tried to simplify the creation of ajax style applications with my YAJAF! javascript library/Ajax framework. I think I’ve come up with a way to build on the tacit knowledge of GUI programmers, creating an extremely flexible library/framework, and making it all very ‘natural’ to use for programmers of traditional object oriented languages. I haven’t released it yet, and I’m trying to see if there’s any interest in doing so, check it out and let me know what you think.

  2. #2 by jeffro on January 23, 2006 - 12:22 pm

    I would be interested in taking your framework for a test drive. I have been using SACK simply because it does exactly what I want, and its light weight. As opposed to Rico, or Prototype, or Script.aculo.us that weight in over 100K!!

  3. #3 by mikepk on January 23, 2006 - 8:28 pm

    Thanks for the feedback, I’ve posted all over the place (including ajaxian and tech crunch) and it just doesn’t seem like there’s that much interest for a new framework. My dynamic loader starts with 3k but only loads the pieces it absolutely needs. I haven’t actually calculated what the total pull off the server is (after the loader runs for one of my sample apps) but I can’t imagine it being more than 10-15k.

    What would be in the perfect framework for you? Any advice for me? So far I’ve been designing to all my own requirements, so I’d be curious how other might use it.

    I’ve been thinking of setting up a web IDE with color coded keywords, syntax checking, and generation of code that could then be used any way you want. Would that be interesting?

Comments are closed.