ASP.NET MVC 3 Preview 1 is Released and Catching Up with MVC 2

Amgen Campus, Thousand OaksOne indicator of success for me is seeing me complaining about “nothing” to do. Nothing to do means that, say, the release of the ASP.NET  MVC 3 Preview 1 would be an exciting event—something for me to jump all over and Blog about on a clean desk with birds chirping on a quiet, verdant day. Nope…

While the new bits are shown on camera on the Microsoft campus, I’m behind, grasping a few known unknowns:

“Fluent HTML?”

Speaking of MVCContrib, there’s an issue that’s older than MVC 2 (and in some ways older than ASP.NET 2.0): in the MVC space this to-do has the title “Fluent HTML.” Tim Scott writes:

I have come to truly hate the overloading approach taken by the out-of-the-box Html helpers.  Methods with long signatures are hard to read, and it takes investigation to see what’s happening.  What’s worse, you must worry about problems with overload resolution, especially when some parameters are typed as object.  As a result, HtmlHelper is not easily extensible.  It’s hard to bend it to do new things without breaking existing functionality.  We saw an example of this when Beta1 was released with breaking changes.  With a fluent interface, it’s much easier to extend with new behaviors while leaving existing behaviors closed.

What some call “fluency” certain folks in the Java world named “method chaining”—not to be confused with “constructor chaining.” And there’s more confusion: many a fashionable developer will use the term “fluent interface” to talk about a pattern that likely shows method chaining. This might suggest that interface-based programming has something to do with fluent design when it does not.

As a jQuery convert—and as a dot-syntax LINQ writer—I do find fluency elegant compared to complex method signatures (even ones with named parameters). As bachelor of physics, my background in Newton’s calculus (not to be confused with Leibniz) leads me to add the word fluxion on to fluent. Recall Newton’s fluents and fluxions?

My only complaint with fluent programming is that the order of method chaining is not easily discoverable. For example the MVCContrib Grid requires Render() or RenderUsing() be called last. What is strange to me is this need for knowing the order of chaining does not bother me when writing LINQ. With the right amount of free time, one could look into this issue. Not yet…

rasx()