Showing posts with label mvc. Show all posts
Showing posts with label mvc. Show all posts

Tuesday, October 21, 2008

Adventure game via jQuery, AJAX, and MVC

Next quarter, I'm very likely going to be tasked with starting work on the MVC version of our company's public-facing website. It's going to be a massive undertaking, especially for me given how little I know of the company's system. That's okay though. I'm confident that I'll manage get up to speed in that time. I've already made great strides, if I do say so myself.

Meanwhile, one of the real innovations we're going to join in on is the whole jQuery / AJAX / MVC bandwagon. Personally I think this is great - I'm absolutely in love with all three technologies, especially given how easy they are to integrate together. Smitten though I may be, however, I'm most definitely not as proficient with them as I will have to be in order to pursue an undertaking of this magnitude.

To that end, I've decided I'm going to create a fun little project that will hopefully get me up to speed. I am going to write a little adventure game using jQuery, AJAX, and the ASP.NET MVC Framework. When I say adventure game, think Colossal Cave Adventure or Zork. It's not going to be fancy at all, or probably even all that fun for anyone but myself, but that's not the point. I want to use this as a learning tool - and I plan on posting on my progress and insights here.

I'm thinking about starting an open source project for this so you guys can check out my progress, if you want. Meanwhile, I need to think of a name... =)

Friday, September 5, 2008

ASP.NET MVC Preview 5, jQuery, and Validation

I've been given an interesting task - figure out how to provide both client-side and server-side validation of forms, without duplicating the validation logic.

The ASP.NET MVC team just released Preview 5, which, among other bits of goodness, includes the ability to perform server-side validation automagically, and have the results of this validation sent to the view. It's pluggable, much like the rest of the framework.

Meanwhile I went in search of a validation framework (admittedly so I wouldn't have to write my own) and found ValidationFramework - which upon inspection appears to be exactly what I need for server-side validation. It's a well-put-together framework, and has an extensibility model that includes outputing client-side validation for ASP.NET using server controls.

Of course, ASP.NET server controls aren't the best solution when working with the MVC framework, so I considered writing my own adapter layer to generate some Javascript validation from the existing validation rules. I remembered the jQuery Validation plugin and, while I haven't explored it fully, considered that a good starting point.

Well, it seems I wasn't the only one to think so, as this discussion thread shows. I've been in contact with the original poster - Dane O'Connor - and have been reviewing the latest drops of a set of helpers and extensions on both ASP.NET MVC P5 and ValidationFramework that achieves exactly what I initially set out to do on my own!

Now I just have to hope that I'll be allowed by my employer to contribute some code to this project, as we'll be using the system in a production environment. Any improvements we provide would benefit others as well, and since the code is free, I'd like to give something back.

That's it for now.

Tuesday, August 26, 2008

ASP.NET MVC Preview 4

Gotta say, I'm impressed. I've been tinkering with it for a short while, and already I'm happy. It's a complex beast, that's for sure, but there's a lot of convention (rather than configuration) that manages a lot of the complexity for you.

That said, there is little in the way of official guidance out there so far. Rob Conery's MVC Storefront screencast series has been a great resource for me, but sometimes I find it hard to follow. Meanwhile a lot of the really great blog posts are getting out of date as the framework matures.

Maturity is a good thing, though, even if it means the information we have on the framework is spotty. There are a few good books on the subject coming out soon, but that doesn't help me now. My employer is encouraging me to get acquainted with the framework, as we'll be using it (likely before the official release) to replace our customer-facing website. Which is exciting - I'm optimistic about the project - but also worrying, especially if there are large breaking changes between Preview 4 and release.

But alas. All this in the name of progress - and don't let my worries fool you, it is progress, away from the leaky abstractions and inane page lifecycle of Web Forms. It is not a step back as some profess. Certainly it is easy to use ASP.NET MVC to create code that is hard to understand - but the same is true of any technology, no matter the paradigm.

In short, I'm absolutely in love with the framework, and although I have my worries, I have no doubt I'll continue to use it in preference to Web Forms for all my projects moving forward.