AOP某些术语的由来 [英] Origin of some of AOP's terminology

查看:106
本文介绍了AOP某些术语的由来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为以前曾有人问过这个问题,但是我无法立即找到相关的SO问题或与此有关的其他文章.

I would think this question have been asked before, but I was not immediately able to find related SO questions, or articles elsewhere for that matter.

让我惊讶的是,AOP中的某些术语相当奇怪.看来我不是唯一的人-这个 article 指出不幸的是,AOP术语并不是特别直观".但是,如果可能的话,我还没有找到说明为什么它们不那么直观"的资源.

It strikes me that certain terms in AOP are rather strange. It seems I'm not the only one - this article, for instance, notes that "unfortunately, AOP terminology is not particularly intuitive". However, I have not found a resource explaining why they are not more "intuitive", if that's possible.

更具体地说:我可以稍微理解方面"和连接点"-它们似乎具有足够的描述性.但是切入点"和建议"似乎有些奇怪.这些术语是如何产生的?

More specifically: I can somewhat understand "aspect" and "join points" - they seem descriptive enough. But "pointcuts" and "advice" seem somewhat odd. How did these terms come about?

我认为,了解这些术语的词源将有助于更好地记住它们,即使不能对AOP设计师的思想有所了解.至少,我希望这可以帮助我避免在会议上浪费诸如切点"或建议点"之类的荒谬事物.

I think knowing the etymology of these terms will help in remembering them better, if not allowing for some insight into the thinking of AOP's designers. At least, I hope this will help me from ever blubbering out nonsensical things like "cut points" or "advice points" in meetings...

推荐答案

词源学无济于事.您将只需要学习术语.但是,关于有关将如何使用某些术语的历史信息,也许您需要执行网络搜索,对于StackOverflow而言,这并不是真正的问题.至少我为您找到了有关术语建议的一些背景信息.

Etymology will not help much. You will just have to learn the terminology. But as for historical information about how some terms came about to be used, maybe you need to perform a web search, it is not really a question for StackOverflow. At least I found some background info about the term advice for you.

更新:实际上,您不需要熟悉太多的技术术语.以下是我的AOP幻灯片之一.我使用它们是为了在指导他们时向开发人员介绍AOP:

Update: Actually there are not so many technical terms you need to be familiar with. The following is from one of my AOP slides. I use them in order to introduce AOP to developers when coaching them:

  • 方面包含以模块化方式实现跨领域关注的所有必要元素.因此,这很像是针对核心问题的课程.
  • 方面可以像类一样包含称为建议的某种方法"和数据.它可以是单例,也可以实例化多次,具体取决于其用法.
  • 由于方面是独立于核心系统定义的,因此我们需要其他一些东西才能将其正交功能编织到核心代码中.这称为切入点,它确定应在何处应用建议,例如在某些方法调用之前或之后,发生异常时,何时创建对象等等.
  • 在核心代码中可能会使用方面代码的任何地方或事件都称为 joinpoint .
  • An aspect contains all necessary elements to implement a cross-cutting concern in a modular way. So, it is much like what a class is for a core concern.
  • An aspect can, like a class, contain some kind of "methods" called advice and data. It can be a singleton or instantiated multiple times, depending on its usage.
  • Because an aspect is defined independently of the core system, we need something else to weave its orthogonal functionality into the core code. This something is called a pointcut and determines where an advice should be applied, e.g. before or after certain method calls, upon an exception, when an object is created and so forth.
  • Any place or event in the core code where aspect code can potentially be woven in is called a joinpoint.

如果您需要婴儿床或记忆钩,也许会有所帮助(请注意斜体字):

If you need a crib or memory hook, maybe this helps (please note the words in italics):

  • 建议有关如何应用横切关注点的核心代码的方面方法称为建议.
  • 您可以将核心代码中的
  • 每个(可以插入到表中)以应用于跨领域关注点,称为连接点. 您可以通过称为 pointcut 的查询语法(例如SQL选择表行)从核心代码连接点中剪切一个切片(或子集).
  • The aspect method which advises the core code about how to apply a cross-cutting concern, is called advice.
  • Each point in your core code which you can hook into in order to apply a cross-cutting concern, is called a joinpoint.
  • You cut a slice (or subset) off of your core code joinpoints by means of a query syntax (like SQL selects table rows) called pointcut.

我不知道这是否有帮助,但我希望如此.

I do not know if this is helpful, but I hope so.

这篇关于AOP某些术语的由来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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