November 2009 - Posts

Crushed by complexity—me too, and for a long time

I had no sessions on ASP.NET MVC in this Fall DevConnections, but I’ll have quite a few in the upcoming Spring 2010 event which will coincide with the Launch event of VS 2010. Yet, many of the questions I got at the end of my sessions (code design, domain model, social network applications, jQuery UI) revolved around ASP.NET MVC and, as one nicely said, my recent conversion to it J

Technically speaking, it is not a matter of a conversion.

I didn’t change my mind about it. More simply, I decided to have, at last, a non-superficial look at it. I got to know it, and I recognized its inherent superior architecture, its core simplicity, its extensibility that largely stems from proper class design. It is so extensible that … it can be made any complex and sophisticated without impacting people just looking for a close-to-the-metal framework.

This is a stunning point compared to Web Forms.

In Web Forms you have to fight to achieve simplicity (the definition of simplicity generally agreed on in 2009), and you can hardly have it cheap, and often you can hardly have it full. In ASP.NET MVC, instead, you currently have to fight to have some good complexity and abstraction in the view. Still provided that wanting a grid can be considered a form of complexity.

So why did I toughly disregarded ASP.NET MVC from about one year since its inception? Let’s look at the dates.

·         October 2007: Microsoft releases the Preview 1 of ASP.NET MVC. And I was among the first to write a comment (see DotNetSlackers.com) and to emphasize its real REST nature versus the alleged MVC-ism.

·         October 2008: After a wave of Preview X, Microsoft releases Beta 1. And I started on it—very slowly—but started. My articles on aspnetPRO (now DevConnections magazine) witness that, as they start with the January 2009 issue.

·         March 2009: Microsoft releases v1.0. And I see the (green) light.

Now what?

Hey, but in this way you didn’t help Microsoft to build to product. I don’t work for Microsoft. I work for myself and another company—and it’s hard enough J

Hey, but in this way you didn’t help the community (and yourself) to have a better product. Well, this is a more delicate point that probably has a lot to do with what I really do every day. I do help clients building their own systems, but I’m hardly sitting writing production code. All I need is, knowing a number of products/frameworks deep enough at their core to deliver classes, write books, create prototypes and proofs of concept, and fix hard design issues. (Little detail—with a bit of money attached.)

Hey, so you want to be paid to share your high thoughts on Preview 345 of any SomePieceOfSoftware framework? As long as previews come out every four weeks or so (not to mention nightly builds you can optionally look at), well, it’s a lot of (my) time. It means subtracting time to projects, clients, family, friends, and worst of all, tennis J  Getting a return doesn’t necessarily mean getting some cash, however. It just means getting a return of any type that has value for you. Quite simply, I don’t see any value for me in previewing CTP 4 of the 3rd week of 7th month of the year.

There’s a popular proverb we use in Italy (it probably exists in other languages too) that is used to celebrate the old good times. It says “there’s no more the half-season” and it is used typically to complain about the weather too hot in April or too cold in October. The common wisdom expects some sort of transition between changes in season.

In software, we always had sharp changes—from version N to version N+1. But now on the wave of open-source and community-driven projects, in software we are having the concept of the half-version introduced. And worse yet the transition is getting longer and longer. The granularity of the release breaks in smaller pieces every day. The average number of Previews grows, followed by a few CTPs, then Beta 1, then Beta 2, then a few RCs, and finally RTM.

Is it all of it? Not yet. There’s an immediate SP1 for anything that didn’t make it in the RTM and perhaps a R1 or R2 later on.

The software product is like a mutant virus—you don’t know its direction (and it can get worse at any time) until it reaches the Beta 2 stage. After that, it will certainly mutate again but is now harmless for developers J

Crushed by complexity” is the title of a session that Billy Hollis delivered at DevConnections. Unfortunately, I couldn’t be there but whatever he said I feel I agree J

ASP.NET MVC is MUCH better than MS seems to think

Here at DevConnections I just attended the ScottGu’s keynote on Visual Studio 2010 and Web development. I haven’t had much time to spend on the latest Beta of Visual Studio 2010 yet so I found most of the information quite helpful and interesting. It looks like Microsoft is finally coding some good functionalities from ReSharper and .NET Reflector inside of Visual Studio 2010.

Little gems like “Generate stub method” or “Display the hierarchy of calls” are now available natively. Still ReSharper is a must I think, but it is good to have a really better VS. By the way, I haven’t seen yet a preview of ReSharper for VS 2010 so the gap might still be quite large J

My primary focus these days is for ASP.NET MVC as I’m doing—guess what—a book scheduled for the release of the .NET 4 platform next April. I particularly loved the TDD spin of ASP.NET MVC that is visible from tooling support. I’m not simply emphasizing the possibility of doing unit tests; I’m referring to the possibility of writing tests first and then the code. And here’s that facilities like stub method and types generation come into play.

And finally, I respectfully but strongly disagree on the slant of many Microsoft presentations that touch on ASP.NET MVC. I disregarded ASP.NET MVC for too long. Now that I got to know it from the inside, well, it’s the best (large) piece of code I’ve seen for a long time.

It’s much better than MS seems to think and tell.

In my opinion, it really represents the way to go for most developers in the mid term. It is probably premature to suggest today that Web Forms be abandoned to embrace ASP.NET MVC. But the new framework (in version 2.0 with Visual Studio 2010) drives you toward better code. Don’t get it wrong: ASP.NET MVC doesn’t automagically make your code clean, elegant and flexible. You still have to go a long way ahead but it puts you on the right track and delivers an environment where you can write testable and practice seriously with unit testing.

A point that Scott made about ASP.NET MVC is that it gives you total control over HTML. Not that this is a false statement, but it happens because server controls are marked as evil. They still work (even though their use may compromise the design—hold on) if you want and if you use the increase your distance from HTML. But on the other hand, if you stop using server controls in Web Forms you get closer to the HTML metal also in Web Forms. So in the end the reason for using ASP.NET MVC is Separation of Concerns and testability.

Eventually, Microsoft will be able to add that to Web Forms too, perhaps via the MVP pattern as the Web Client Software Factory framework attempted to do a while back. 

More Posts