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

查看:33
本文介绍了一些 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:

  • 方面包含以模块化方式实现横切关注点的所有必要元素.所以,这很像一个类用于核心问题.
  • 方面可以像类一样包含某种称为建议的方法"和数据.它可以是单例或多次实例化,具体取决于其用途.
  • 因为方面是独立于核心系统定义的,所以我们需要其他东西来将其正交功能编织到核心代码中.这被称为切入点,它决定了应该在哪里应用建议,例如在某些方法调用之前或之后、发生异常时、创建对象时等等.
  • 核心代码中可以潜在地编织方面代码的任何位置或事件都称为连接点.
  • 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):

  • 向核心代码提供关于如何应用横切关注点的建议的方面方法称为建议.
  • 核心代码中的每个,您可以挂钩以应用横切关注点,称为连接点.
  • 您通过称为切入点的查询语法(如 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天全站免登陆