面向切面编程到底发生了什么? [英] What ever happened to Aspect Oriented Programming?

查看:18
本文介绍了面向切面编程到底发生了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我记得在 1990 年代末和 2000 年代初,面向切面编程 (AOP) 应该是下一件大事".现在我看到一些 AOP 仍然存在,但它似乎已经淡入了背景.

I remember that in the late 1990s and early 2000s Aspect Oriented Programming (AOP) was supposed to be the "Next Big Thing". Nowadays I see some AOP still around, but it seems to have faded into the background.

推荐答案

在 2000 年代初期可能有很多炒作,发生的事情如下:已经有很多尝试创建面向方面的框架,并且这些尝试已合并为 Java 领域的两个重要项目:AspectJ 和 Spring AOP.AspectJ 是完整的、复杂的、学术的,有点过度设计.Spring AOP 覆盖了 80% 的用例,复杂性为 20%.

There has maybe been a lot of hype in the early 2000's, and what happened is the following: there has been a lot of attempts to create aspect-oriented frameworks, and these attempts have merged into two significant projects in the Java sphere: AspectJ and Spring AOP. AspectJ is complete, complex, academic, somewhat overengineered. Spring AOP covers 80% of use cases with 20% of complexity.

如果您查看 Google 趋势中的术语 "AspectJ, Spring AOP",然后对比Java本身的流行度,你会发现AspectJ的相对流行度是有些稳定的,但是Spring AOP在上升.这意味着人们使用 AOP,但不想要 AspectJ 的复杂性.我认为 AspectJ 的创造者犯了很多战术上的错误;AspectJ 一直是一个研究项目,并不是为大众"而设计的.

If you look at Google Trends for terms "AspectJ, Spring AOP", then compare to the popularity of Java itself, you will see that the relative popularity of AspectJ is somewhat constant, but Spring AOP is raising. That means that people use AOP, but don't want the complexity of AspectJ. I think that the creators of AspectJ made a lot of tactical mistakes; AspectJ has always been a research project and has not been designed "for the masses".

在 .NET 领域,我们在 2000 年代初期看到了对 AOP 的类似兴趣.2003 年,当我开始 AOP 研究时,有六个 AOP 编织者用于 .NET;所有人都在走AspectJ的道路,并且都处于婴儿阶段.这些项目都没有幸存下来.基于此分析,我构建了 PostSharp,它旨在覆盖 80% 的用例,复杂度为 20%,但使用起来比 Spring AOP 方便得多.PostSharp 现在被认为是 .NET 的领先方面编织者.PostSharp 2.0 建立在 5 年的反馈和 AspectJ 的行业经验的基础上,并带来了企业就绪"的 AOP(未来将判断这种说法是否值得).除了 PostSharp,其他重要的参与者是 Spring Framework for .NET 和 Windsor Castle,这两个以 DI 为中心的应用程序框架提供了也"方面(方面被视为注入到构造对象中的依赖项).由于这些技术使用运行时编织,它们具有严重的技术限制,因此实际上它们只能用于服务对象(这就是这些应用程序框架的设计目的)..NET 中的另一个启动项目是 LinFu,它可以也"做方面.

In the .NET sphere, we have seen a similar interest for AOP in the early 2000's. In 2003, when I started AOP researches, there were half a dozen of AOP weavers for .NET; all were following the path of AspectJ, and all were in infant stage. None of these projects survived. Based on this analysis, I built PostSharp, who was designed to cover 80% of use cases with 20% of complexity, and yet was much more convenient to use than Spring AOP. PostSharp is now considered the leading aspect weaver for .NET. PostSharp 2.0 builds on 5 years of feedback and from industry experience of AspectJ and brings "enterprise-ready" AOP (future will judge if this claim is deserved). Besides PostSharp, other significant players are Spring Framework for .NET and Windsor Castle, two DI-centric application frameworks providing 'also' aspects (aspects are considered as dependencies injected into constructed objects). Since these technologies use runtime weaving, they have severe technical limitations, so practically they can be used only in service objects (that's what these application frameworks have been designed for). Another starting project in .NET is LinFu, which can do 'also' aspects.

简而言之,AOP 格局在去年经历了一些整合,可能进入了生产力阶段:客户会使用它,因为它确实省钱,而不是因为它很酷.即使它很酷:)

To be short, the AOP landscape has undergone some consolidation last years, and probably enters the phase of productivity: customers will use it because it really saves money, not because it is cool. Even if it is very cool :).

哦,我忘了:大多数应用服务器都内置了对 AOP 的支持.考虑 JBoss、WebSphere,在某种程度上,还有 WCF.

Oh, and I forgot: most application servers have built-in support for AOP. Thinking of JBoss, WebSphere, and, to some extent, WCF.

这篇关于面向切面编程到底发生了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆