Gregory M. KapfhammerAssociate Professor of Computer Sciencehttp://www.cs.allegheny.edu/~gkapfham/ |
Getting Started with AspectJ
- What is AspectJ and how is it related to the more general notion of aspect-oriented programming (AOP)?
AspectJ is an extension to the Java language that supports aspect-oriented programming. AspectJ allows the Java programmer to implement many crosscutting concerns via pointcuts and advice. bps
AspectJ is a general purpose aspect-oriented extension to Java. It helps to make us aware that we making calls outside or our current class and makes crosscutting known to the programmer and how to implement them efficiently with pointcuts.
Joe Zumpella
AspectJ is a an extension for the Java programming language. It enables Java to support aspect-oriented programming. "AO languages have three critical elements: a join point model, a means of identifying join points, and a means of affecting implementation at join points." AspectJ provides each of these. A join point model "provides the common frame of reference that makes it possible to define the structure of crosscutting concerns." A method call join point (the type of join points discussed in the article) "is the point in the flow when a method is called, and when that method call returns." AspectJ identifies these join points, including join points that cross cut classes. AspectJ, once it has identified these join points can offer advice to the programmer on how to best implement these crosscutting methods with pointcuts.
Dan Fiedler
AspectJ extends the functionality of Java. It allows the developer to capture the structure of the crosscutting in the program. In addition, it allows trace statements and other debugging tools such as contract enforcement to remain in the code for future use by making them aspects which can be removed from the compile configuration at the appropriate time.
Elizabeth Zehner
- What is a "crosscutting concern" and how would you implement this type of concern in AspectJ?
A crosscutting concern is an obstacle encountered by the developer that does not stay local to a certain module of the system – instead, it crosses many boundaries and therefore makes development more difficult. This type of concern is addressed by implementing join points and pointcuts, where the pointcut defines what happens when its parameters are met: that is, at its join points. bps
A crosscutting concern happens when a programmer makes calls that are not local to the class or certain module and this can make programs very complex, making development very difficult. With AspectJ we can use using pointcut designators to identify certain join points by filtering out a subset of the join points in the program. These pointcut designators can be defined and in turn they can identify join points from many different classes, which helps us to crosscut classes. Joe Zumpella
A crosscutting concern occurs when a crosscutting method makes "ripples" throughout the code. What I mean by this is that the method is used by or affects classes outside the current class or module. AspectJ helps to resolve this issue by implementing point cuts at certain join points. The point cut executes extra code that can define the parameters and actions taken at the join point, making it easier to resolve a crosscutting concern. As far as I can tell, pointcuts basically attempts to isolate the method calls of a crosscutting method at its various join points in the different classes where the method appears.
Dan Fiedler
A crosscutting concern is finding the structure of what code call what by using join points (where the control flow enters and exits code modules throughout the execution of the program). These concerns are implemented like all other concerns in AspectJ - through AspectJ modules in the code.
Elizabeth Zehner
- What are development aspects and production aspects? How are these two types of aspects different?
Development aspects are those that are used during the application's development. They provide debugging, testing, and performance-oriented work. AspectJ allows the developer to modularize all of the functionality that enables him to maintain the internal status of the application, and also allows him to turn on and off this functionality at will.
Production aspects are those that are intended to be included in the final application. They add functionality and the developer uses an aspect-oriented technique to keep this functionality modularized.
These two aspects differ in that the former is intended only for development whereas the latter is an integral part of the application. bps
The development aspects are debugging, testing, and performance tuning of applications. These aspects occur during development. These aspects define behavior from simple tracing to profiling to testing of internal consistency inside the application. These aspects help us to find the little details and fine tune the program.
Production aspects implement functionality which is included in shipping applications. These are usually included in the final application. They can be small and simple but are actually very important and often help to make easier understanding and maintaining of the program. An example here would be the design structure which helps us to understand the program. The difference between the two are all noted above in the explanations of each. Joe Zumpella
"An aspect is a modular unit of crosscutting implementation." Aspects can have methods, fields, constructors, initializers, named pointcuts, and advice.
Development aspect: Aid in testing, debugging (tracing statements and the pre/post conditions of design by contract), and dealing with performance concerns. Used during the development phase.
Production aspect: Provide modular functionality using aspects in the, or define design structure of the, final (or release I suppose) version of a product,
Dan Fiedler
Development Aspects: "A modular unit of corsscutting implementation. It is devined very much like a class, and can have methods, fields, constructors, initializers, named pointcuts, and advice."
Production aspects: "Aspects that are inherently intended to be included in production build of an application."
The difference between these two is that development aspects are debugging aspects such as trace points and production aspects are intended to stay in the code.
Elizabeth Zehner
(Note: In order to completely answer these questions, you might need to do some reading beyond the assigned article. Try to search the Web to find other papers that discussion AOP. Greg)
1. AspectJ is a general-purpose AOP extension to Java. AspectJ is realated to AOP by joins. The joins allow for AspectJ to relate to original AOP, but to also make it more simple. There are two categories of aspect. AspectJ maked AOP technology more quickly and also more efficient. AOP is the concern of scattered calls to classes from one single class. AspectJ tries to simplify the notify the programmer that he/she is calling outside of the class and that crosscutting is occuring.
2. From what I can find online about crosscutting concern, it is the scattering of code over multiple classes within and around the same function call. According to what I can find, AspectJ tries to notify the programmer with notifications within the document of crosscutting occuring. These "advise declarations are used to dfine additional code that runs at join points."
3. Developement Aspects have to do with debugging, testing and performance tuning of applications and Production aspects have to do with the shipping and final product. Development Aspect concerns more exclusively with the implementation of the program. The Production Aspect has to do with more of the visual and production builds of the application, not the programming. By using development aspect, we can fine tune the program. With Production aspect, we can more clearly define what the design structure of the system is and should be.
Chris Howell
Link to this Page
- Software Implementation last edited on 10 December 2002 at 10:35 pm by resh204.allegheny.edu