News

ASP.NET on Rails, Finally

ASP.NET 3.5 Extensions brings Ruby on Rails’ functionality to ASP.NET.

Nothing has prevented ASP.NET developers from using a model view controller (MVC) architecture. But it's likely to get much easier next year, when Microsoft releases an MVC option as part of an extensions plug-in to its Web app framework.

"It's going to be great," says Don Demsak, a New Jersey-based .NET solutions consultant and blogger who's 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's 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."

Available this month, the first community technology preview (CTP) of ASP.NET 3.5 Extensions 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's 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 Nov. 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.

Microsoft's MVC
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.

Data-Driven Developments
The dynamic data support in ASP.NET 3.5 Extensions is provided in large part by a third-party open source .NET toolset called 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 didn't buy SubSonic: "SubSonic will remain under the same MPL [Mozilla Public License] 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.

Silverlight 2.0 Announced

On Nov. 29, Microsoft changed the version number on the upcoming Silverlight 1.1 to 2.0. The move is based on a host of new functionality planned for the next release, which is the first offering built on a subset of the .NET Framework.

"They should have called the first release .5 and this release 1.0," says Don Demsak, a New Jersey-based .NET solutions consultant.

Silverlight 2.0, expected to ship as a Go-Live beta in the first quarter of 2008 -- probably at the MIX '08 event -- will offer what Microsoft is calling a "compatible subset of the WPF UI Framework." It will also provide 20 UI controls in key areas such as layout, forms and data management, including a DataGrid.

The most recent 1.1 -- now 2.0 -- alpha dropped in September. The next Silverlight 2.0 preview release will add support for LINQ to XML and Web standards (REST, POX, RSS, WS*), according to a blog posting by Microsoft GM Scott Guthrie.

"They're just supporting standards, which is somewhat unique for Microsoft," says Roger Jennings, principal consultant at Oakleaf Systems. "They were originally going to have Astoria use W3C, which is a proprietary Microsoft wire format, and dropped that in favor of ATOM."

"Astoria is not part of ASP.NET, it's just a very complementary technology," says Roger Jennings, principal consultant at Oakleaf Systems in California 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 back-end."

The ASP.NET 3.5 Extensions release will offer controls to support Silverlight and ASP.NET integration, according to Guthrie.

Extensible Infrastructure
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're hitting those pain points, then the MVC framework is something that you might want to look into, because you're 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 release to manufacturing by next summer.

About the Author

Kathleen Richards is the editor of RedDevNews.com and executive editor of Visual Studio Magazine.

comments powered by Disqus

Featured

Subscribe on YouTube