AOSD1 Aspect-Oriented Software Design Karl Lieberherr Theo Skotiniotis.

Slides:



Advertisements
Similar presentations
A Brief Introduction to Aspect-Oriented Programming Zhenxiao Yang.
Advertisements

Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
1 JAC : Aspect Oriented Programming in Java An article review by Yuval Nir and Limor Lahiani.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development.
1 An Aspect-Aware Outline Viewer Michihiro Horie and Shigeru Chiba Tokyo Institute of Technology, Japan.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Modularization.
20-May-15 Aspect-Oriented Programming Dave Matuszek University of Pennsylvania.
Overview of AspectJ Aspect Oriented Software Development Seminar Technion presented by Oren Mishali.
Aspect-Oriented Programming In Eclipse ® Aspect-Oriented Programming in Eclipse with AspectJ Dr Helen Hawkins and Sian January.
Java.sun.com/javaone/sf | 2004 JavaOne SM Conference | Session BUS JavaOne 2004 What is AOP? Gregor Kiczales AspectMentor.com and University of.
Aspect-Oriented Software Development (AOSD) Tutorial #2 AspectJ Basics.
ASPECT ORIENTED SOFTWARE DEVELOPMENT Prepared By: Ebru Doğan.
University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales.
Aspect-Oriented Software Development (AOSD) Tutorial #2 AspectJ Basics.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Regression Test Selection for AspectJ Software Guoqing Xu and Atanas.
26-Jun-15 Aspect-Oriented Programming. 2 Programming paradigms Procedural programming Executing a set of commands in a given sequence Fortran, C, Cobol,
Aspect Oriented Programming Written by Michael Beder.
Harmless Advice Daniel S Dantas Princeton University with Prof. David Walker.
More on AspectJ. aspect MoveTracking { private static boolean _flag = false; public static boolean testAndClear() { boolean result = _flag; _flag = false;
Aspect-Oriented Software Development (AOSD) Tutorial #3 AspectJ - continued.
Aspect-Oriented Software Development (AOSD) Tutorial #3 AspectJ - continued.
Introduction to Aspect- Oriented Programming CS 3360 Gregor Kiczales, et. al. Getting started with AspectJ, CACM, 44(10):59-65, October Fall 2012.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Debugging Support.
Introduction to Aspect Oriented Programming Presented By: Kotaiah Choudary. Ravipati M.Tech IInd Year. School of Info. Tech.
Aspect Oriented Programming (AOP) in.NET Brent Krueger 12/20/13.
CMSC 202 Exceptions. Aug 7, Error Handling In the ideal world, all errors would occur when your code is compiled. That won’t happen. Errors which.
Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development 1.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
Aspect Oriented Programming Gülşah KARADUMAN.
Slides for Gregor Kiczales Two versions –short version: Crosscutting capabilities for Java and AspectJ through DJ (4 viewgraphs only) –long version: Controlling.
A Meta-Level Specification and Profile for AspectJ in UML Joerg Evermann School of Information Management Victoria University of Wellington.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
Virtual Support for Dynamic Join Points C. Bockisch, M. Haupt, M. Mezini, K. Ostermann Presented by Itai Sharon
Aspect-Oriented Programming and Modular Reasoning G. KiczalesM. Mezini Presented by Alex Berendeyev.
AOP Foundations Doug Orleans Karl Lieberherr. What we did earlier AOP languages have the following main elements: –a join point model (JPM) wrt base PL.
IDENTIFYING SEMANTIC DIFFERENCES IN ASPECTJ PROGRAMS Martin Görg and Jianjun Zhao Computer Science Department, Shanghai Jiao Tong University.
Inter-Type Declarations in AspectJ Awais Rashid Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
AspectJ – AOP for Java Tom Janofsky. Instructor at Penn State Abington Consultant with Chariot Solutions JUG Member.
Course Progress Lecture 1 –Java data binding: Basket example: UML class diagram -> class dictionary without tokens-> language design -> class dictionary.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
1 Contract-based Verification for Aspect-oriented Refactoring Naoyasu Ubayashi(Kyushu Institute of Technology) Jinji Piao(Kyushu Institute of Technology)
Demeter Aspects We study techniques for the emerging area of Aspect-Oriented Software Development and focus on the following areas:  Aspectual Collaborations.
Chapter 8: Aspect Oriented Programming Omar Meqdadi SE 3860 Lecture 8 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Aspect Oriented Development Alex Beatty.  Purpose  Cross-cutting Concerns  Join Points, Pointcuts, and Advices  Weaving  Invasive vs. Non-Invasive.
Alloy-based Lightweight Verification for Aspect-oriented Architecture Naoyasu Ubayashi(Kyushu Institute of Technology) Yuki Sato(Kyushu Institute of Technology)
AOP and observer pattern. Design pattern General reusable solution to a commonly occurring problem in software design Not a finished design that can be.
Extending the Field Access Pointcuts of AspectJ to Arrays ICS 2006 – Taipei, December 2006 Kung Chen and Chin-Hung Chien* National Chengchi University.
Aspect Oriented Programming Adlux Consultancy Services Pvt Ltd
问题 Code scattering Blocks of duplicated code Blocks of complementary code, and different modules implementing complementary parts of the concern Code.
AOSD'04, Lancaster, UK 1 Remote Pointcut - A Language Construct for Distributed AOP Muga Nishizawa (Tokyo Tech) Shigeru Chiba (Tokyo Tech) Michiaki Tatsubori.
R R R A Brief Introduction to Aspect-Oriented Programming.
Introduction to Aspect- Oriented Programming CS 3360 Gregor Kiczales, et. al. Getting started with AspectJ, CACM, 44(10):59-65, October Spring 2012.
CSC450 Software Engineering Devon M. Simmonds University of North Carolina, Wilmington 1.
A first language for Aspect-Oriented Programming
Why Should You Care About Aspect-Oriented Programming? Karl Lieberherr CCIS.
Aspect-Oriented Software Development (AOSD)
1 Aspectual Caml an Aspect-Oriented Functional Language Hideaki Tatsuzawa Hidehiko Masuhara Akinori Yonezawa University of Tokyo.
PPL 2004, Gamagori, AICHI1 Remote Pointcut - A Language Construct for Distributed AOP Muga Nishizawa (Tokyo Tech, Japan) Shigeru Chiba (Tokyo Tech, Japan)
Features of AOP languages AOP languages have the following main elements: –a join point model (JPM) wrt base PL –a specification language for expressing.
An Interface Mechanism for Encapsulating Weaving in Class-based AOP
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Demeter Aspects Who We Are Aspectual Collaborations
Aspect-Oriented Programming
A Brief Introduction to Aspect-Oriented Programming
AspectAda Aspect-Oriented Programming for Ada95
Classes, Objects and Methods
Aspect Oriented Software Design
CMSC 202 Exceptions.
Presentation transcript:

AOSD1 Aspect-Oriented Software Design Karl Lieberherr Theo Skotiniotis

AOSD2 AOSD and AOP Emerging Addresses crosscutting concerns Current technologies: ad-hoc, decrease the benefits of encapsulation, modularization and ease of extensibilty.

AOSD3 Crosscutting Concerns Concern = system property –Functional property –Constraint of system behavior Constraints on a system refer to conditions that need to be satisfied when the system runs –Logging of read/write operations on all pumps –Authorization –Synchronization

AOSD4 Crosscutting Concerns Are those system concerns which take effect over multiple artifacts within a design or program. Artifact = any tangible object at any level of the software development process.

AOSD5 Aspects In the context of AOSD, are a new modularity mechanism with which crosscutting concerns can be expressed. An aspect holds all the information (operations and data) that a crosscutting concern uses/manipulates. An aspect is bound to a context.

AOSD6 Aspects Better modularity. Crosscutting concerns are now localized in an aspect. Easier understanding. The information about a concern is localized. It is less scattered and tangled with other information. Easier modifiability. Look at one aspect and its binding.

AOSD7 Binding Model Separating the operations and data which a crosscutting concern deals with is the first step: aspectual data type. One needs to define at which points within your design implementation an aspect gets to execute its code. Binding of an aspect. A join point model provides the glue between aspectual data types and the binding of them.

AOSD8 Join Point Models We want to specify conditions under which methods should execute. Those methods that execute conditionally when an event happens are called advice. However, there are AOP languages that unify methods and advice. Example: Fred: Doug Orleans, NEU PhD student.

AOSD9 Join Point Models In this context: dynamic join points, e.g. call join points. Need a mechanism to specify sets of join points. Use some primitives and the set operations.

AOSD10 OOSD and AOSD Two common concepts: –Separation of concerns –Modularization But OOSD does not handle well the crosscutting concerns.

AOSD11 Note on AspectJ Binding of an aspect (which expresses the details of the crosscutting) is a part of an aspect itself.

AOSD12 Looks familiar? aspect Supplier { void add (Object target, String i) {} void around (Object target, String i): call(void Supplier.add(Object, String)) && args(target, i) { targets.put(target,i); } … HashMap targets = new HashMap();

AOSD13 Development Aspects LoD checker! Tracing, Logging, and Profiling Pre- and Post-Conditions

AOSD14 Development Aspects aspect SimpleTracing { pointcut tracedCall(): call(void FigureElement.draw(GraphicsContext)); before(): tracedCall() { System.out.println( "Entering: " + thisJoinPoint); } }

AOSD15 Development Aspects When debugging, programmers often invest considerable effort in figuring out a good set of trace points to use when looking for a particular kind of problem. When debugging is complete or appears to be complete it is frustrating to have to lose that investment by deleting trace statements from the code. The alternative of just commenting them out makes the code look bad, and can cause trace statements for one kind of debugging to get confused with trace statements for another kind of debugging.

AOSD16 Very Specific Profiling aspect SetsInRotateCounting { int rotateCount = 0; int setCount = 0; before(): call(void Line.rotate(double)) { rotateCount++; } before(): call(void Point.set*(int)) && cflow(call(void Line.rotate(double))) { setCount++; } } Shape: from LR to PS* We don’t care what is in between.

AOSD17 Pre- and Post- Conditions aspect PointBoundsChecking { pointcut setX(int x): (call(void FigureElement.setXY(int, int)) && args(x, *)) || (call(void Point.setX(int)) && args(x)); pointcut setY(int y): (call(void FigureElement.setXY(int, int)) && args(*, y)) || (call(void Point.setY(int)) && args(y)); before(int x): setX(x) { if ( x MAX_X ) throw new IllegalArgumentException("x is out of bounds."); } before(int y): setY(y) { if ( y MAX_Y ) throw new IllegalArgumentException("y is out of bounds."); } }

AOSD18 Advice Precedence in AspectJ Multiple pieces of advice may apply to the same join point. In such cases, the resolution order of the advice is based on advice precedence If the two pieces of advice are defined in –different aspects, then there are three cases: dominates, subaspect, undefined. –in the same aspect, then there are two cases: Textual order: After-reverse and other-normal.

AOSD19 Different aspect rules If aspect A is declared such that it dominates aspect B, then all advice defined in A has precedence over all advice defined in B. Otherwise, if aspect A is a subaspect of aspect B, then all advice defined in A has precedence over all advice defined in B. So, unless otherwise specified with a dominates keyword, advice in a subaspect dominates advice in a superaspect. Otherwise, if two pieces of advice are defined in two different aspects, it is undefined which one has precedence.

AOSD20 Same aspect rules If the two pieces of advice are defined in the same aspect, then there are two cases: –If either are after advice, then the one that appears later in the aspect has precedence over the one that appears earlier. –Otherwise, then the one that appears earlier in the aspect has precedence over the one that appears later.

AOSD21 Circularity These rules can lead to circularity, such as aspect A { before(): execution(void main(String[] args)) {} after(): execution(void main(String[] args)) {} before(): execution(void main(String[] args)) {} } such circularities will result in errors signalled by the compiler.

AOSD22 Effects of precedence At a particular join point, advice is ordered by precedence. –A piece of around advice controls whether advice of lower precedence will run by calling proceed. The call to proceed will run the advice with next precedence, or the computation under the join point if there is no further advice.

AOSD23 Effects of precedence –A piece of before advice can prevent advice of lower precedence from running by throwing an exception. If it returns normally, however, then the advice of the next precedence, or the computation under the join point if there is no further advice, will run.

AOSD24 Effects of precedence –Running after returning advice will run the advice of next precedence, or the computation under the join point if there is no further advice. Then, if that computation returned normally, the body of the advice will run.

AOSD25 Effects of precedence –Running after throwing advice will run the advice of next precedence, or the computation under the join point if there is no further advice. Then, if that computation threw an exception of an appropriate type, the body of the advice will run.

AOSD26 Effects of precedence –Running after advice will run the advice of next precedence, or the computation under the join point if there is no further advice. Then the body of the advice will run.