分享
计算机专业英语4.doc
下载文档

ID:3347632

大小:33.50KB

页数:3页

格式:DOC

时间:2024-03-02

收藏 分享赚钱
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,汇文网负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
网站客服:3074922707
计算机专业 英语
计算机专业时文选读(971) Aspect-Oriented Programming Aspect-oriented programming (AOP) is an approach to programming that allows global properties of a program to determine how it is compiled into an executable program. The conceptualizers of AOP compare aspect programming to the manufacturing of cloth in which threads are automatically interwoven. Without AOP, programmers must stitch the threads by hand. AOP complements object-oriented programming by allowing the developer to dynamically modify the static object-oriented model to create a system that can grow to meet new requirements, allowing an application to adopt new characteristics as it develops. AOP provides a solution for abstracting cross-cutting code that spans object hierarchies without functional relevance to the code it spans. Instead of embedding cross-cutting code in classes, AOP allows you to abstract the cross-cutting code into a separate module (known as an aspect) and then apply the code dynamically where it is needed. You achieve dynamic application of the cross-cutting code by defining specific places (known as pointcuts) in your object model where cross-cutting code should be applied. At runtime or compile time, depending on your AOP framework, cross-cutting code is injected at the specified pointcuts. Essentially, AOP allows you to introduce new functionality into objects without the objects’ needing to have any knowledge of that introduction. Aspect-oriented software development (AOSD) is a new approach to software development that addresses limitations inherent in other approaches, including object-oriented programming. AOSD aims to address crosscutting concerns by providing means for systematic identification, separation, representation and composition. Crosscutting concerns are encapsulated in separate modules, known as aspects, so that localization can be promoted. This results in better support for modularization hence reducing development, maintenance and evolution costs. The following terms are often used in AOP: Aspect An aspect is a subprogram that is associated with a specific property of a program. As that property varies, the effect “ripples” through the entire program. The aspect subprogram is used as part of a new kind of compiler called an aspect weaver. Aspect is a construct, resembling classes, for addressing concerns that cut across classes. An aspect can contain methods and fields, extend other classes or aspects, and implement interfaces. Aspects in AOP package advice and pointcuts into functional units in much the same way that object-oriented programming uses classes to package fields and methods AspectC++ An aspect-oriented extension to the C++ programming language. AspectJ An aspect-oriented extension to the Java programming language. Advice Code that runs after certain conditions are met. Advices allow you to transparently apply things like logging and metrics to an object model.. Concern Some functionality or requirement necessary in a system that may or may not have been implemented in a code structure. Concerns can range from high-level notions like security and quality of service to low-level notions such as caching and buffering. They can be functional, like features or business rules, or systemic, such as synchronization and transaction management. Crosscutting Two concerns crosscut if the methods related to those concerns intersect. An aspect crosscuts the traditional class and method boundaries by applying the same code in each. Interceptor Used to implement an advice in JBoss 4.0, a popular Java application server. Introduction A way to add methods or fields to an existing class, to bring multiple inheritance to plain Java classes or to attach a new API to an existing object model. Used in JBoss 4.0. Joinpoints Points, or hooks, in a program’s execution where enhancements can be added or behaviors attached. For example, joinpoints could define calls to specific methods in a class. Pointcuts Program constructs that designate joinpoints and collect specific context at those points. In AOP, pointcuts define the points in your model where advice will be applied. Weave To assemble an individual concern into a process by interlacing different execution-logic fragments according to some supplied criteria. Metadata Additional information that can be attached to a class or a given instance of an object, either statically or at runtime. Metadata helps when writing truly generic aspects that can be applied to any object, but the logic needs to know class-specific information.   面向方面程序设计   面向方面程序设计(AOP)是一种编程方法,允许以程序的整体特性来确定它如何编译成可执行程序。要说明AOP的概念,可以将方面编程类比成织布,这时纱线自动织成布。而没有AOP,程序员必须用手来织布。   AOP是对面向对象程序设计的补充,它允许开发人员动态修改静态的面向对象模型,以生成能成长的系统,来满足新的要求,从而让应用程序在发展过程中适应新的特性。   AOP为把横切代码抽象提供了解决方案,而横切代码在没有与这些代码功能关联性的情况下跨跃了对象的层次。AOP让你将横切代码抽象进入另外的模块(称作方面),来替代将横切代码嵌入类,然后动态地在需要它的地方应用这些代码。通过定义对象模型中应该应用横切代码的具体地方(称作点切),就能获得横切代码的动态应用。在运行时或编译时,依据你的AOP架构,横切代码注入到特定的点切。从本质上讲,AOP允许你将新的功能引入对象,而对象不需要拥有任何有关引入的知识。   面向方面软件开发(AOSD)是软件开发的新方法,它要解决其他方法(如面向对象程序设计)中固有的局限性。AOSD通过提供系统的识别、分离、表示和组合等方法,目的是要解决横切关注。横切关注被封装在其他的模块中,称作方面,从而可以促进本地化。这就带来了对模块化的更好支持,因此降低了开发、维护和升级的成本。   下面是在面向方面程序设计时常用的一些术语:   方面(Aspect)   方面是与一个程序的具体特性有关联的子程序。当特性改变时,就会影响到整个程序。方面子程序用作一类称作方面编织器的新编译器的一部分。   方面是一个与类相似的结构,用于解决横切类的关注。方面可以包含方法和属性、扩展其他的类或方面以及实现接口。   AOP的方面将告知和点切引入功能单元,与面向对象程序设计使用类来包装属性和方法很相似。   AspectC++   对C++编程语言的面向方面的扩展。   AspectJ   对Java编程语言的面向方面的扩展。   忠告(Advice)   在满足某些条件后运行的程序代码。忠告允许你透明地将诸如登录和规格等应用于对象模型。   关注(Concern)   以一种代码结构实现的或者尚未实现的系统中所必需的某些功能或要求。关注的范围上至高级的概念(如安全和服务质量)、下至低级的概念(如高速缓存和普通缓存)。它们可以是功能性的,像特性或商业规则,或者是系统性的,如同步和交易管理。   横切(Crosscutting)   如果与两个关注有关的方法相交叉了,那么这两个关注就横切了。通过应用相同的代码,方面横切了传统的类和方法边界。   截取器(Interceptor)   用于实现JBoss 4.0中的忠告,JBoss 4.0是一种流行的Java应用服务器。   引入(Introduction)   将方法或属性加到已有类上的方式,或者将多个继承带到普通的Java类上,或者将新的API(应用编程接口)连到已有的对象模型。用于JBoss 4.0。   连接点(Joinpoints)   程序执行中可以加入增强行为或附加上行为的点,即钩子。例如,连接点能定义对类中特定方法的调用。   点切(Pointcuts)   指定连接点和收集这些点上具体的上下文的程序构建。在AOP中,点切定义你的模型中的这些点,在这些点上应用忠告。   编织(Weave)   按照提供的一些标准将不同的执行逻辑段组装编译在一起,从而将一个关注装入一个进程。   元数据(Metadata)   附加的信息,能在静态或者运行时加到类上或者对象的给定事例中。元数据在编写真正的通用方面时有帮助,这种方面能应用于任何对象,但程序逻辑需要知道类特定的信息。

此文档下载收益归作者所有

下载文档
你可能关注的文档
收起
展开