Interferences: aspect-base and between aspects Shmuel Katz, using slides from Lodewijk Bergmans.

Slides:



Advertisements
Similar presentations
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
Advertisements

An Aspect-Oriented Approach For Web Application Access Control Presented by: Mohamed Hassan Carleton University Carleton University
ASTA Aspect Software Testing Assistant Juha Gustafsson, Juha Taina, Jukka Viljamaa University of Helsinki.
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 Modular Verification of Strongly Invasive Aspects Authors: Emilia Katz, Shmuel Katz The Technion.
Aspect-Oriented Software Development (AOSD) Tutorial #10 Interference among Aspects.
1 Relational Algebra & Calculus. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.  Relational.
Software Reliability CIS 640 Adapted from the lecture notes by Doron Pelel (
The Z Specification Language
Classes and Object- Oriented... tMyn1 Classes and Object-Oriented Programming The essence of object-oriented programming is that you write programs in.
Aspect-Oriented Software Development (AOSD) Tutorial #10 Interference among Aspects.
ASPECT ORIENTED SOFTWARE DEVELOPMENT Prepared By: Ebru Doğan.
Categories of Aspects Shmuel Katz Computer Science Department The Technion Haifa, Israel.
1 Detecting Interference or Proving Interference Freedom Among Aspects Shmuel Katz Computer Science Department The Technion.
Rigorous Fault Tolerance Using Aspects and Formal Methods Shmuel Katz Computer Science Department The Technion Haifa, Israel
Harmless Advice Daniel S Dantas Princeton University with Prof. David Walker.
Aspect-Oriented Software Development (AOSD) Additional Tutorial.
More on AspectJ. aspect MoveTracking { private static boolean _flag = false; public static boolean testAndClear() { boolean result = _flag; _flag = false;
Describing Syntax and Semantics
School of Computer ScienceG53FSP Formal Specification1 Dr. Rong Qu Introduction to Formal Specification
1 Relational Algebra and Calculus Yanlei Diao UMass Amherst Feb 1, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
Aspect-Oriented Software Development (AOSD) Tutorial #9 Modular Verification of Aspects.
Aspect-Oriented Software Development (AOSD) Tutorial #9 Modular Verification of Aspects.
Deriving AO Software Architectures using the AO-ADL Tool Suite Luis Fernández, Lidia Fuentes, Mónica Pinto, Juan A. Valenzuela Universidad de Málaga
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
Introduction to Aspect Oriented Programming Presented By: Kotaiah Choudary. Ravipati M.Tech IInd Year. School of Info. Tech.
Mathematical Modeling and Formal Specification Languages CIS 376 Bruce R. Maxim UM-Dearborn.
Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Change Impact Analysis for AspectJ Programs Sai Zhang, Zhongxian Gu, Yu Lin and Jianjun Zhao Shanghai Jiao Tong University.
VERIFICATION OF ASPECT ORIENTED MODELS BY DON MARTIN JAYASHREE VENKIPURAM PATHANGI PIYUSH SRIVASTAVA REFERENCES F. Mostefaoui and J. Vachon,” Design level.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
Hyper/J and Concern Manipulation Environment. The need for AOSD tools and development environment AOSD requires a variety of tools Life cycle – support.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
Aspect Oriented Programming Gülşah KARADUMAN.
VERIFICATION OF ASPECT-ORIENTED MODELS Review of Aspect-Oriented Definitions aspect – crosscutting concern that may involve multiple classes pointcut –
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 6 Using Methods.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
1 Relational Algebra & Calculus Chapter 4, Part A (Relational Algebra)
1 Relational Algebra and Calculas Chapter 4, Part A.
Categories of Aspects Shmuel Katz Computer Science Department The Technion Haifa, Israel.
An Overview of Aspects Shmuel Katz Computer Science Department The Technion
Slicing AspectJ Woven Code Luca Cavallaro Mattia Monga Antonio Castaldo D'Ursi Davide Balzarotti Politecnico di Milano.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
Demeter Aspects We study techniques for the emerging area of Aspect-Oriented Software Development and focus on the following areas:  Aspectual Collaborations.
Network Protocols Network Systems Security Mort Anvari.
Concern Architecture View and Aspect-Oriented Design Mika Katara and Shmuel Katz Tampere U. T. Technion, Haifa.
Alloy-based Lightweight Verification for Aspect-oriented Architecture Naoyasu Ubayashi(Kyushu Institute of Technology) Yuki Sato(Kyushu Institute of Technology)
Two-Phase Commit Brad Karp UCL Computer Science CS GZ03 / M th October, 2008.
Qusay H. Mahmoud CIS* CIS* Service-Oriented Computing Qusay H. Mahmoud, Ph.D.
POSL (Principles of Software Languages) Gr. Kyushu Institute of Technology, Japan 1 A Verification Mechanism for Weaving.
1 Incremental Analysis of Interference Among Aspects Authors: Emilia Katz, Shmuel Katz The Technion.
 2001 Lodewijk Bergmans University of Twente Pattern Languages.
Design-Directed Programming Martin Rinard Daniel Jackson MIT Laboratory for Computer Science.
1 Separation of Context Concerns --- Applying Aspect Orientation to VDM Naoyasu Ubayashi (Kyushu Institute of Technology) Shin Nakajima (National Institute.
R R R A Brief Introduction to Aspect-Oriented Programming.
Basic Concepts and Definitions
From Aspectual Requirements to Proof Obligations for Aspect- Oriented Systems Shmuel Katz and Awais Rashid The Technion Lancaster University Haifa, Israel.
Aspect-Oriented Software Development (AOSD)
1 Aspectual Caml an Aspect-Oriented Functional Language Hideaki Tatsuzawa Hidehiko Masuhara Akinori Yonezawa University of Tokyo.
Agenda  Quick Review  Finish Introduction  Java Threads.
Interface specifications At the core of each Larch interface language is a model of the state manipulated by the associated programming language. Each.
ALLOY: A Formal Methods Tool Glenn Gordon Indiana University of Pennsylvania COSC 481- Formal Methods Dr. W. Oblitey 26 April 2005.
Healing Data Races On-The-Fly
Software Engineering Lecture 7
Aspect Validation: Connecting Aspects and Formal Methods
Presentation transcript:

Interferences: aspect-base and between aspects Shmuel Katz, using slides from Lodewijk Bergmans

Composition Conflicts (code interference) Syntactical –e.g. in the case of source code weaving the woven code can no longer compile Structural –E.g. when introducing an existing method or creating cyclic inheritance Semantic –Sometimes directly derivable from code e.g. variable access, calling dependencies –design intentions "is it a bug, or is it a feature?" e.g. ordering of actions/events

Major Classification 1.aspect-base composition 2.aspect-aspect composition especially at shared join points –(but not exclusively) 3.Due to weaving process/specification

1. Aspect-base interference Obliviousness is bliss? – obliviousness ≠ (programmer) ignorance it is about reducing (cyclic) coupling hence tool support can make a large practical difference –scalability is an issue, though –Goal: developer responsible for creating a dependency must be accountable for the consequences: so one introducing an aspect should show it does not make new problems (“cause no harm”) kind of interferences: –behavioral conflicts (changing state or control flow) –through structural changes

Design information in pointcuts: treating the fragile pointcut problem Fragile pointcuts: –susceptible to ‘break when changes are made to the (base) program. e.g. “ call(void *.set*(Object))” Design intentions or: semantic information (semantic properties) –are implicitly present (encoded, hard-wired) in the sources of the program –Semantic property is an abstract notion; e.g. behavior of a program element, its intended meaning. We would like to use design intentions as concrete ‘hooks’ to identify join points –hence not rely on the 'accidental' structure and naming conventions of the program

'Semantic Pointcuts' expressing design intentions in pointcuts Be able to refer to annotations in pointcuts Reduces the obliviousness: need annotations Example (in AspectJ 5): –Dedicated Pointcuts pointcut foo(Customer c): target(c) && && … –Extending Type Patterns pointcut updateMethods(): *) && * *(..));

2. Aspect-Aspect interference Indirectly through the base program –affecting the base program causes other aspects to break because their assumptions are violated –can be due to: state change control flow changes structural changes

Aspect-Aspect interference Cont'd Interference at shared join points –depending on the correct composition operators Can have one affect the other, or both relate only to base dependencies among aspects e.g. conditional execution –semantic incompatibility among aspects/advices—in every composition only in specific base context –i.e.aspect1/aspect2/baseX conflict –affected by different orderings

Aspect Interference How can this happen? –Separation of concerns: Pointcuts are developed separately Thus, we may not be aware of shared join points –Aspects are usually written in Turing complete advices  AspectJ, AspectC++, AspectWerkz, JBossAOP … This makes it hard to reason about the sanity of the composition E.g. “What is the intended behavior of not calling the proceed in one specific around advice?”

Aspect Interference Semantic conflicts –Is the intended behavior preserved when composing two aspects? –Hard to detect as you have to know the semantics of advice –“A semantic conflict, is a situation where the composition of multiple advices influences the behavior of the advices or of the base system, causing the system requirements to be violated.”

Example: Encryption: –Encrypt all outbound traffic on some protocol call(* *.sendData(String)) && args(data)  Encrypt advice –Decrypt all inbound traffic on some protocol call(* *.receiveData(String)) && args(data)  Decrypt advice Logging: –Log all sent and received data on the protocol: call(* *.receiveData(String) || * *.sendData(String)) && args(data)  Log advice

Example: Protocol class void sendData(String) void receiveData(String) EncryptLogDecrypt Protocol class void sendData(String) void receiveData(String) EncryptLog Encrypt DecryptLog Decrypt Superimposition Composition

Example: Both orderings are correct from a compiler point of view! However, depending on the requirements one order might be intended. –In a hostile domain we want to ensure that no unencrypted data is read. –In a protocol debugging domain we need to read the unencrypted data. Assume we want the latter option: –Log before Encrypt and Decrypt before Log

Other examples “If the authorization aspect denies access for a state- changing operation, a second aspect may not be executed" –e.g. the authorization around advice does not do a proceed() "combining a real-time constraint aspect and a (possibly blocking) synchronization constraint" "two advices that both modify e.g. the arguments or return value of a call" –unless these are associative modifications

Aspect ordering Ordering of advice at shared join points –execution 'must' be sequential an order is always chosen –ordering may affect behavior desired order is determined by requirements! –  explicit, finegrained ordering specification is required AspectJ: 'declare precedence' EAOP: advice composition (  ) Compose*: declarative, fine-grained composition specification –ordering –conditional execution –static constraints

Semantic Interference Among Aspects: a formal view One aspect causes another to operate incorrectly even though: Aspect A satisfies its specification (P A, R A ) Aspect B satisfies its specification (P B, R B ) Recall P is assumption about base and R is guarantee about augmented We have a base system satisfying both P A and P B

Aspect Interference A, B – aspects; S – underlying system (S + A) +B  WRONG S + A  OK OR (S + B) +A  WRONG S + B  OK OR S + (A+B)  WRONG

Example: Internet Access to Bank Accounts Underlying system: Internet terminal Server send (login, password) grant_access (info)

Adding Password Encryption Aspect A, responsible for encryption. A’s pointcut: a password is sent from login screen A’s assumption, P A : password- containing messages are sent only from login screen A’s guarantee, R A : each time any password is sent, it is encrypted

Example – contd. Internet terminal Server send (login, password) grant_access (info) Aspect A: encrypt(password) System S:

Retrieve Forgotten Psw. Aspect B s the forgotten password if the security questions are answered B’s pointcut: a password is forgotten B’s assumption, P B : existence of an introductory operation, indicating that a password is forgotten B’s guarantee, R B : each time a password is forgotten, it’s ed to the user, provided security questions are answered

Example – contd.(2) Internet terminal Server send (login, encr(password)) grant_access (info) Aspect B: retrieved psw. S+A: forgot psw.

Example – contd.(3) Internet terminal Server send (login, encr(password)) grant_access (info) Unencrypted!!! (S+A)+B: forgot psw. B psw.

Cause of the problem Common join-points? – No. Updating shared variables? – No. The semantics of A and B? – Yes! 1. B’s advice ( ing password) violates A’s guarantee (all passwords encrypted)  B can not be woven after A. 2. B’s advice violates A’s assumption (passwords sent from Login Screen only)  A can not be woven after B

Semantic Interference – more formally A – aspect, specified by (P A, R A ) B – aspect, specified by (P B, R B ) Definition: A does not interfere with B if for every system S, (*) (*) Notation: OK AB Need to prove: OK AB and OK BA

Proving Non-Interference Theorem (dividing the proof task): To prove OK AB, it’s enough to show [KP AB ] (A preserves the assumption of B) [KR AB ] (B preserves the guarantee of A)

Direct Proof Method: Based on Maven tool explained earlier 1. Build tableau T for P A  P B 2. Use MAVEN to prove OK AB - weave A into T, then weave B - show R A  R B on the result 3. Use MAVEN to prove OK BA - weave B into T, then weave A - show R A  R B on the result

Incremental Proof Method 1.Use MAVEN to prove KP AB - build tableau T P for P A  P B - weave A into T P - show P B on the result 2. Use MAVEN to prove KR BA - build tableau T R for R A  P B - weave B into T R - show R A on the result 3, 4 (for KP BA, KR BA ) – symmetric (  OK BA )  OK AB

Incremental method - advantages 1.Easier weaving 2.Quicker verification 3.Simplifications to 2 verification tasks (in not-so-rare special cases) 4. Advantage in failure analysis: the verification step at which we obtained the counterexample helps show exactly which aspect caused interference and how (= which property was violated) Cause: smaller models and TL formulas

Bank system – verification failures KR AB fails  B can not be woven after A, because it does not preserve the guarantee of A, R A (B sends ed password unencoded) KP BA fails  B can not be woven before A, because B violates the assumption of A, P A (the passwords are sent not only from the “login” screen)

Ongoing research Analyze counterexamples to correct assumption/pointcut/advice/guarantee Investigate various weaving strategies including advice with joinpoints inside Show categories of aspects have special interference properties Detect interference problems for real-life collections of aspects

A Common Aspect Proof Environment (CAPE) A framework with multiple tools for analyzing aspects and augmented systems Preliminary version is under development by Technion, INRIA, Twente Univ., Lancaster Univ. Includes syntactic analysis, model checking, type checking, for common internal representations Can treat different aspect languages

AOSD-Europe 6 th Programme EU Network of Excellence on Aspect-Oriented Software Development Includes those already listed, IBM, Siemens, and 5 other Universities Developing tools for aspects, including easy aspect verification See

Conclusions Aspects provide opportunities, but need analysis –New kind of modularity (cross-cutting) and reuse –Potential for “on-demand” adaptation –Relevant for all stages of software development Formal Methods for software deserve consideration –Elegant applications of mathematics (logic) –Software crisis in reliability, expensive debugging –Tools are finally becoming practical Their combination has especially interesting questions and is potentially useful and practical