Microsoft Releases ASP.NET 3.5 Extensions Preview
Nothing has prevented ASP.NET developers from using a model view controller (MVC) architecture. But it's likely to get a lot easier with Microsoft's ASP.NET 3.5 Extensions, which will include the highly anticipated MVC option. The first preview of the technology was released today.
"It is going to be great," says Don Demsak, a New Jersey-based .NET solutions consultant and blogger, who is trying out the new framework. "Especially for folks who are doing complicated business domain scenarios or prefer design patterns for more maintainable code."
The Ruby on Rails crowd absolutely loves the MVC style, he says. "So obviously Microsoft is looking to take advantage of that and there is definitely a segment of their core people -- namely the enterprise developers -- who are very interested in moving to the Ruby on Rails side because of that, so Microsoft needed to have an answer."
The ASP.NET 3.5 Extensions CTP showcases MVC, support for REST, additional AJAX functionality, and dynamic data controls, according to a blog posting by Microsoft Developer Division General Manager Scott Guthrie. (It is not a reiteration of ASP.NET Futures released in June 2007.)
The ASP.NET 3.5 Extensions CTP follows Visual Studio 2008 and .NET Framework 3.5, released to manufacturing on November 19. .NET 3.5 integrates ASP.NET AJAX and LINQ. It also adds support for nested Web pages and data view and data grid controls.
The MVC architecture is used in many Web app frameworks, including Castle's MonoRail, Apache Struts and Ruby on Rails. It enforces a separation of the Web app into components: the interfaces (views), the business logic (models) and a controller that moderates the traffic flow. For developers who are working on large enterprise apps, this means code that can be better maintained, and tested as discrete units to the level of methods and individual classes.
"ASP.NET is so easy to use for the rapid app developer, but for the enterprise folks, the people who need to build maintainable code, ASP.NET is a nightmare because of the design style that Microsoft did," explains Demsak. "It was originally designed for the original VB6 crowd -- using WinForms -- to switch over to the Internet. They did a lot of techniques to make it seamless for them but in taking those shortcuts, in dealing with that encapsulation there, it made it harder to maintain, especially for folks who like to use design patterns to build their code."
The MVC design style conforms to the separation of concerns principle, which makes it a lot easier to maintain code, he says. "The core of MVC is that it makes it easier to write unit tests. So you could test your view and your controller without having to speak HTML -- you don't have to do it through a browser."
Is Microsoft moving to MVC and away from ASP.NET's current component control-driven model WebForms? According to Guthrie, with ASP.NET 3.5 Extensions, developers can choose the MVC design patterns, WebForms, or use both in the same application.
The dynamic data controls first appeared in the ASP.NET Futures May CTP. This functionality will also be available as a plug-in through the open source .NET toolset SubSonic. The creator of SubSonic, Rob Conery, joined Microsoft in October to "build out" SubSonic on top of ASP.NET as the toolset for the MVC option. As Conery notes in his blog, Microsoft did not buy SubSonic: "SubSonic will remain under the same MPL 1.1 license it always has, and will remain as completely Open Source as it always has--nothing will change at all," he explains. "I'm just getting paid, essentially, to work on it."
The SubSonic toolset includes support for building a data access layer, and a scaffolding framework -- similar to Ruby on Rails -- that enables developers to use pre-built models to "auto-generate" data-driven Web sites.
Microsoft is also planning to release the ADO.NET Entity Framework, which was pushed out of band after the first Orcas beta, and a REST-based data services model in parallel with the ASP.NET 3.5 Extensions, according to Guthrie. Some of the functionality was previewed in the Astoria incubation project.
"Astoria is not part of ASP.NET, it is just a very complementary technology," says Roger Jennings, principal consultant at Oakleaf Systems in Calif., and a blogger on data-related technologies. "It has a great deal of promise, especially in conjunction with Silverlight. And now that Silverlight 2.0 will have JSON, ATOM and RSS wire formats, the two will mesh very nicely."
He adds, "The Entity Framework is not a critical piece of the Astoria project. They can use anything as a data backend."
The ASP.NET 3.5 Extensions release will offer controls to support Silverlight and ASP.NET integration, according to Guthrie.
In addition to SubSonic, Microsoft's MVC will support integration with other frameworks and tools. Users will be able to integrate views, models and other components from the MonoRail stack. Launched in 2005, MonoRail is an open source .NET framework based on MVC, run by Castle Project and licensed under Apache Software Foundation 2.0.
The MVC team at Microsoft may have learned a few things from the backlash at the MVP Summit over the problems with the ADO.NET Entity Framework. Many MVPs felt that the company didn't bother to look at other object-relational mapping (ORM) technologies and learn from the pain points.
"The upshot is that Microsoft is actually listening," says Demsak, "especially to enterprise developers who are having a hard time maintaining their code with classic ASP.NET. If you are hitting those pain points, then the MVC framework is something that you might want to look into, because you are getting rid of things like View State and stuff like that which is always a pain."
Microsoft's Web development platforms are rapidly advancing -- and in some respects, catching up. ASP.NET, which is built on .NET, is the programming model for the Internet Information Services (IIS) component of Windows Server. Windows Server 2008 will ship with IIS7; both platforms are based on a new modular architecture. IIS7 offers tighter integration with the .NET framework, allowing developers to use any .NET language, according to Guthrie. Microsoft is also working on a Web application deployment framework for IIS7 that will enable users to "roll back" to earlier versions of a Web app, and deploy across a single server or server farms.
ASP.NET 3.5 Extensions is expected to RTM by next summer.
Kathleen Richards is the editor of RedDevNews.com and executive editor of Visual Studio Magazine.