拼吾爱程序人生其他编程JavaSpring Mark Pollack on Spring and Spring.NET

1  /  1  页   1 跳转 查看:976

Mark Pollack on Spring and Spring.NET

Mark Pollack on Spring and Spring.NET

Posted by Jonathan Allen  From/InfoQ

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.


 感谢原创者的辛勤劳动,希望对您有所帮助,转载请注明原出处。
 您可能对 [Spring] 的这些文章也感兴趣:

春天来啦:Spring框架概述 - SPRING框架——由来和发展
Spring Dynamic Modules继续改进
Rod Johnson Discusses SpringSource dm Server 1.0
Spring的切入点之三:动态Pointcut
使用 Spring 的JMX annotation 让POJO对象输出到JMX
Mark Pollack on Spring and Spring.NET
Spring的切入点之二:静态Pointcut的例子
为Web应用构建Spring—Seam混合型组件
什么是Spring
从Spring+Struts到Grails
 

回复: Mark Pollack on Spring and Spring.NET

译/李剑

Spring.NET的创始人Mark Pollack谈论了在Java与.NET社区之间共享思想和Spring.NET的历史。他还说到了如何使用依赖注入和AOP来提供日志以外更多的功能,以及Spring.NET与WCF所重叠的地方。

JAOO上的采访之外,我们还针对最近Spring.NET 1.1的发布进行了一次简短的问答。

很多.NET的开发者都对Spring.NET有点陌生。你能给我们介绍一下这个项目,解释一下它背后的一些历史吗?
Spring.NET是一个开源的应用程序框架,它可以简化构建企业级.NET应用的工作。虽然这是所有应用程序框架所致力追求的目标,但Spring.NET是建立在Spring框架所使用的模式和编程模型的基础之上的,而后者已经为我们带来了很多实实在在的利益。我在2003年使用Java开发金融服务行业的一些项目时,对Spring的作用有了切身体会。我最开始所感受到的好处之一是,它可以很容易地创建松耦合的应用,于是我的应用无论是单元测试还是集成测试都很方便。第二点直接的收益就是我的代码可以更加关注于业务概念。很多底层架构的问题——例如配置和事务管理——都在Spring中得到了漂亮的解决,我无须在业务类中自己写这些代码了。最后,处理底层数据库API也会带给人锥心的疼痛,Spring提供了一个非常出色的帮助类库,编写数据访问代码就容易了很多。
在这个版本中有很多新特性。从可以快速得到收益的角度来讲,你觉得哪一处是对新用户最有吸引力的呢?
我在2004年初开始接触.NET开发,而后很快就确认了我的直觉,也就是Spring所提供给Java的一切在.NET中依然有价值。从本质上来讲,Spring包装了很多最佳实践,然后让它们可以很容易得以应用。通常来讲,最佳实践和相关联的模式是可以在不同技术之间进行移植的。在四人帮那本书里面所提到的单实例模式是用C++开发的,但这并没有影响这种模式在Java或者.NET的世界中放出应有的光芒。然后我就启动了Spring.NET,希望通过它可以把Spring的种种益处带给.NET社区。从大范围来看,Spring的好处主要是两点,第一是通过依赖注入来配置应用,第二是使用面向方面编程来帮助解决底层架构中的一些问题,例如声明式事务管理。综合使用这两种技术可以让你收获累累硕果。正因如此,Spring.NET最早开发的特性就是依赖注入和AOP框架,它们在1.0版中已经发布了。其他一些着重于解决Web层和中间层的一些特定问题的特性放在了1.1版中。
这一版本为那些早已开始使用Spring.NET的开发者带来了什么?
1.1版中最受欢迎的特性之一就是为ASP.NET开发提供的Web框架。这个框架最基本的功能就是让你可以通过依赖注入来配置页面,user controls,providers等等。它同时还提供了强大的数据双向绑定和验证,胜于ASP.NET自带的功能。这些功能满足了常见的需求,而且开发者通常最后都需要自行开发出来作为内部框架的一部分。另一个主要的新特性是在一个aspect library中提供的声明式事务管理和其他aspects。目前在.NET领域中存在一处欠缺,那就是执行声明式事务管理,尤其是当你只有一个数据库,不想调用MS-DTC的时候。这个aspect library提供了很多aspects,可以即取即用。其中,retry aspect算是特别有用的一个。它可以贯穿所有的WCF客户端代理类,或是其他客户端远程代理,所以如果一个远程方法调用时抛出了异常,这个方法可以被重试多次。
 
1  /  1  页   1 跳转

快速回复帖子

标题
禁用 URL 识别
禁用表情
禁用 Discuz!NT 代码
使用个人签名
  [完成后可按 Ctrl+Enter 无刷新发布]  

版权所有 拼吾爱程序人生    Total Unique Visitors:

web counter

Powered by Discuz!NT 2.1.202   Copyright © 2001-2008 Comsenz Inc. 鄂ICP备07500843号
返顶部