英语达人帮帮忙啊!!请帮我翻译一下这段话!急用,我就这点分了,请谅解一下!

14.1.ASPECTSANDTRANSFORMATIONTheimpetusforaspect-orientedprogrammingisthatinothercodi... 14.1. ASPECTS AND TRANSFORMATION
The impetus for aspect-oriented programming is that in other coding paradigms, the code that implements some features can be scattered across the body of the program, tangled in with code that implements other features. This occurs in features such as logging, caching, and security, where often code of a similar form is invoked many times throughout the program. This code has many disadvantages: It is tedious to write, it is error-prone, it complicates the program, and the calls can add overhead that may be needless for many users.
By inserting these calls automatically, transformation lifts the burden from the programmer and reduces the number of potential errors. This technique gains even more weight when the inserted code is a more complex series of operations that may change at some later point; centralizing the point of programming allows quicker development and enables a higher degree of reuse. However, the task of inserting code can in turn become tedious and error prone. For example, how do you specify where all the insertions must happen? What if the insertions must be customized somehow for each insertion point? Providing a higher-level conceptual interface to describe such changes is a promising technique [2].
The integration of new feature-handling code into a target application has three components: traversal, selection, and generation. A traversal defines an order in which the transformer will visit the code. (Generally, we consider traversal of code statements within a method, but the principle is similar for ordering the visits of methods or classes.) A filter operates on the output of a traversal, selecting individual join points as necessary or not for a given transformation. Finally, a generator creates a new code sequence to insert at the selected point (technically, it may also edit or remove code); it may alter its behavior based on the context passed to it by the traversal or filter. The simplest and most common type of generator uses a statically defined sequence, but the idea is generalizable to the dynamic creation of custom code. Each of these components can be independently specified and can be replaced by alternate implementations to achieve different goals.
For example, consider a transformation to add the Observable design pattern to a target. Its goal is to insert code that marks the object as dirty wherever a change of state occurs. One possible implementation uses a traversal that iterates through the code by basic block. The filter would identify instructions that modify the state of the object, and the generator would insert code marking the object as dirty. Once the filter had identified a valid target, the traversal could then skip the remainder of the basic block, bundling the notification of observers until the end of the method.
展开
伦景明026
2008-03-19 · 超过27用户采纳过TA的回答
知道答主
回答量:160
采纳率:0%
帮助的人:72.1万
展开全部
14.1 。方面与转型
动力面向方面编程是,在其他编码范式,守则可实现的一些功能可以分布在全国各地机构的安排计划,不纠缠在与代码实现了其他一些功能。这发生在功能,如伐木,缓存和安全性,而往往典一个类似的形式,是引用了很多次整个计划。此代码已经有很多缺点:它是繁琐的书写,这是容易出错的,它复杂化计划,并呼吁可以补充开销,可不用为许多用户。
插入这些电话自动变换升降机负担从程序员,并减少一些潜在的错误。这一技术成果,更重的时候,插入码,是一个较为复杂的连串行动,这可能会改变一些后来点;集中点的节目,让快的发展,并实现更高程度的重用。不过,这项任务的插入代码可以反过来变成乏味和易出错。举例来说,你怎么指明所有插入要发生吗?如果插入必须有点个性,为每一个插入点?提供一个较高层次的概念上的接口来形容这种变化是一种很有前途的技术[ 2 ] 。
整合新的功能,处理代码到目标应用有三个组成部分:遍历,选拔和发电。 1遍历定义了一个秩序,在这种秩序变压器将访问代码。 (一般而言,我们认为遍历代码声明一个方法,但原则上是类似的订购访问的方法或班级)一个过滤操作对输出一个遍历,选择单独加入点是必要或不为某一特定转型。最后,一台发电机,开辟了新的码序列插入在选定点(技术上来说,它也可以编辑或删除代码) ,它可以改变其行为的基础上,通过语境所赋予它的遍历或过滤。最简单和最常见的发电机采用了超静定定义序列,不过,我们的构思是,可普及到动态创建的自定义代码。上述每个部件均可单独指定,并可以取代候补执行,以达到不同的目标。
比如,考虑转型,以增加瞄头的设计模式,以一个目标。其目的就是为了插入代码标志着对象作为肮脏而改变的状态出现。其中一个可行的实施使用一个穿越重申通过代码基本块。该过滤器将确定指示修改国家的反对,以及发电机,将插入代码标识对象,因为很脏。一旦过滤器已确定一个有效的目标,遍历便可以跳过其余部分基本块,捆绑通知观察员到年底的方法。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式