Java application frameworks come to .NET

by Yuval Shavit, Associate Editor

Third-party application frameworks have been popular in the Java world for years, but several projects are now trying to bring those tools to .NET. Frameworks like Spring for .NET are introducing developers to concepts like aspect-oriented programming (AOP) and domain driven design (DDD).

The .NET world has always had some things in common with Java -- both technologies rely on compiled bytecode that's executed in a runtime virtual machine -- so it should perhaps be no surprise that some of Java's tools are migrating to .NET. Several established Java-based frameworks are making serious efforts to push into the .NET community, and they're bringing with them methodologies that Java programmers have been using for years.

Many of these frameworks address issues like object-relational mapping (ORM), which provides a layer of abstraction between databases and object-oriented programming languages, and domain driven design (DDD), a programming methodology that tries to separate code into independent levels. The goal is to help programmers create code that's more stratified, so that developers working on business logic don't need to worry about communicating with databases on one end and the GUI on the other.

One such framework is Spring for .NET, a port of the popular Java framework. The latest release, Spring for .NET 1.2 came out last month and has two major additions, said Mark Pollack, the project's principal engineer: configuration of WCF services using dependency injection, and support for aspect-oriented programming (AOP). AOP is a way of compartmentalizing sections -- called aspects -- of your code and identifying functionality -- or "concerns" -- that cuts across several aspects. For instance, logging and exception handling are examples of concerns that touch practically every aspect in a business application, like customer relationship management or billing.

Like its Java counterpart, Spring for .NET is a modular framework; it doesn't force any architectural models, so programmers can use only the components they need. In fact, some Spring for .NET modules provide standard, traditional helper functions, like a wrapper for ADO.NET and NHibernate, a port of the Java ORM framework Hibernate.

Another relative newcomer to the .NET world from Java is Naked Objects, a framework that automatically builds an application's GUI from a set of domain objects that model business tasks. For instance, Naked Objects would render a product information object into a table view or tree in the GUI to expose that product in an inventory application. The Naked Objects framework also contains hooks to connect to data sources; in theory, you could build an entire application just by defining classes that model a business.

Adoption for these frameworks is relatively modest, but growing. Last year, SpringSource, the San Mateo, Calif.-based company in charge of Spring for .NET, held only a couple training sessions, Pollack said; this year it's had 15. And while Naked Objects was only released in November, it's already signed on the Irish government, which is using it for 1,000 internal users and plans to expand that to 4,000 users next year, said Richard Pawson, the company's managing director. Naked Objects is based in Henley-on-Thames, United Kingdom.

Part of that growth comes from senior architects who are familiar with both Java and .NET, Pawson said. This was the case at Viz Risk Management, a Bergen, Norway-based developer. When Viz Risk Management decided to rewrite one of its programs from scratch, the company's lead developer Steinar Dragsnes settled on the Spring for .NET framework as a way to separate concerns within the code and make sure dependencies don't leak in the wrong direction.

All of the developers on the project -- .NET programmers at the core -- like Spring for .NET now, but they were skeptical at first, Dragsnes said. While Java programmers have been using third-party frameworks for years, many .NET programmers are used to a predominantly Microsoft-only stack, he said. Accepting Spring for .NET meant that those programmers now had to branch out and explore online forums, blogs and developer communities they weren't familiar with -- and that they had to accept open source software. Spring for .NET and NHibernate are both open source.

The biggest pain point was in getting his team used to the XML-based configuration that Spring uses, Dragsnes said. To that end, Dragsnes broke the configuration file into several smaller files, each about 50 lines, and wrote wrapper classes for them. Although some of the new ideas, like AOP, took some initial explaining, the group generally embraced those new methods, and Viz Risk Management is now considering rewriting some of its other applications with Spring for .NET, Dragsnes said.

The shift from Java-based frameworks to .NET-based ports of those frameworks is part of a larger trend in which .NET is steadily becoming more innovative than Java, Pawson said. Until a couple years ago, Java had more features and a more vibrant community than .NET, he said. Now, Microsoft is becoming more open, and it's firing back with some unique features of its own -- like LINQ, which Pawson said is by itself a good reason to consider moving from Java to .NET.

0 comments

E-Mail

Username / Password

Password

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy