Mark Pollack on Spring and Spring.NET
Mark Pollack, founder of Spring.NET, talks about shares ideas between the Java and .NET communities and the history of Spring.NET. Topics include how to use dependency injection and AOP for more than just logging and where Spring.NET overlaps with WCF.
In addition to the JAOO Interview, we did a short Q&A on the recent release of Spring.NET 1.1
A lot of .NET developers are not familiar with Spring.NET. Can you start by introducing it and explaining some of the back-story behind it?
Spring.NET is an open source application framework that makes building enterprise .NET applications easier. While this is a goal that all application frameworks strive to fulfill, Spring.NET is based on the patterns and programming model used in the Spring framework for Java which has shown many real-world benefits. I saw firsthand the benefits of using Spring in 2003 when I was doing Java development on several projects within the financial services industry. One of the first benefits I saw as that it was very easy to create loosely coupled applications and as a result my applications became easier to test both at the unit test level and integration test level. The second immediate benefit was that my code became more focused on business concerns. Many infrastructure issues, such as configuration and transaction management, were handled elegantly by Spring instead of having to write that code myself in business classes. Lastly, dealing with low level database APIs was royal pain, and Spring provided a nice helper library that made it much easier to writing data access code.
There are a lot of new features in this release. Which would you consider to the most compelling for new users in terms of quickly paying for themselves?
I started doing .NET development in earnest in 2004 and soon confirmed my hunch that what Spring was offing in Java had value in .NET. Spring was essentially packaging up best practices and making them easy to apply. Generally speaking, best practices and their associated patterns are quite portable across technologies. The singleton pattern in the classic Gang of Four book was developed in C++, but that didn't make it less valuable or less applicable in Java or .NET. As a result, I started Spring.NET to bring those benefits to the .NET community. In a large part, Spring delivers these benefits letting you apply dependency injection to configure your application and use aspect oriented programming (AOP) to help address infrastructure issues, such as declarative transaction management. Using these two techniques together give you a lot of bang for the buck. As such, dependency injection and an AOP framework were the first features to be developed and were in the Spring.NET 1.0 release. Other features, that focus on specific pain points encountered in the web and middle tier were introduced in the 1.1 release.
Turning to developers already using Spring.NET, what does this version have to offer them?
One of the most popular features in the 1.1 release is the web framework for ASP.NET development. The base functionality is to let you configure your pages, user controls, providers, etc. via dependency injection. However, it also offers powerful bi-directional databinding and validation functionality that surpass what you get out of the box with ASP.NET. These features address common needs and is often something that developers end up writing themselves as part of an 'in-house' framework. Another major new feature is declarative transaction management and other aspects provided in an aspect library. There is a hole in the .NET landscape now for performing declarative transaction management, in particular if you only have one database and do not want to involve MS-DTC. The aspect library provides several aspects that can be configured out of the box. Another particularly useful one is the retry aspect. This can be applied across all WCF client side proxy classes, or other client side remoting proxies, so that a remote method invocation can be retried several time if an exception was thrown when invoking the remote method.
Very nice introduction!