Aspect-Oriented Action Semantics Descriptions Luis Menezes University of Pernambuco

Slides:



Advertisements
Similar presentations
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
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.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
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.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development.
Presented by: Thabet Kacem Spring Outline Contributions Introduction Proposed Approach Related Work Reconception of ADLs XTEAM Tool Chain Discussion.
Overview of AspectJ Aspect Oriented Software Development Seminar Technion presented by Oren Mishali.
Object-Oriented Analysis and Design
ALGOL 60 Design by committee of computer scientists: Naur, Backus, Bauer, McCarthy, van Wijngaarden, Landin, etc. Design by committee of computer scientists:
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
ASPECT ORIENTED SOFTWARE DEVELOPMENT Prepared By: Ebru Doğan.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Operational Semantics.
AspectJ2EE/Clasa Israel Institute of Technology The Computer Science department Itay Maman.
Object Oriented Databases - Overview
Aspect-Oriented Software Development (236608) 1 Aspect-Oriented Software Development (AOSD) Tutorial #1 Course site :
Generative Programming. Generic vs Generative Generic Programming focuses on representing families of domain concepts Generic Programming focuses on representing.
C++ fundamentals.
CSC 8310 Programming Languages Meeting 2 September 2/3, 2014.
A Formal Model of Modularity in Aspect-Oriented Programming Jonathan Aldrich : Objects and Aspects Carnegie Mellon University.
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
Advanced Database CS-426 Week 2 – Logic Query Languages, Object Model.
Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.
1COM6030 Systems Analysis and Design © University of Sheffield 2005 COM 6030 Software Analysis and Design Lecture 4 - System modelling Dr Richard Clayton.
Introduction to Object-oriented programming and software development Lecture 1.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
Workshop on Integrated Application of Formal Languages, Geneva J.Fischer Mappings, Use of MOF for Language Families Joachim Fischer Workshop on.
Introduction to Aspect Oriented Programming Presented By: Kotaiah Choudary. Ravipati M.Tech IInd Year. School of Info. Tech.
Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)
Supporting Heterogeneous Users in Collaborative Virtual Environments using AOP CoopIS 2001 September 5-7, Trento, Italy M. Pinto, M. Amor, L. Fuentes,
VERIFICATION OF ASPECT ORIENTED MODELS BY DON MARTIN JAYASHREE VENKIPURAM PATHANGI PIYUSH SRIVASTAVA REFERENCES F. Mostefaoui and J. Vachon,” Design level.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development 1.
Aspect Oriented Programming Gülşah KARADUMAN.
Generative Programming. Automated Assembly Lines.
Joel Phinney March 31, ◦ Concerns  Separation of Concerns, Tangled and Scattered Concerns, Cross-Cutting Concerns, Aspects ◦ Aspect-Oriented Software.
Principles of programming languages 5: An operational semantics of a small subset of C Department of Information Science and Engineering Isao Sasano.
Aspect-Oriented Modeling of Access Control in Web Applications Gefei Zhang Joint work with Hubert Baumeister, Nora Koch and Alexander Knapp UML-BASED WEB.
Methodology: The AOP Refactoring Process Aspect-Oriented Refactoring of the Apache Cocoon Shared-Object Resource Allocation System Jeff Dalton Advisor:
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
CCC: An Aspect-Oriented Intermediate Language on.Net Platform Yingfei Xiong and Feng Wan University of Electronic Science and Technology of China, China.
1 Proving aspect-oriented programming laws Leonardo Cole Paulo Borba Alexandre Mota Informatics Center Federal University of.
Virtual Support for Dynamic Join Points C. Bockisch, M. Haupt, M. Mezini, K. Ostermann Presented by Itai Sharon
Ch. 5 Ch. 51 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (more notes) Dr. Carter Tiernan.
Demeter Aspects We study techniques for the emerging area of Aspect-Oriented Software Development and focus on the following areas:  Aspectual Collaborations.
Applying Translucid Contracts for Modular Reasoning about Aspect and Object Oriented Events Mehdi Bagherzadeh Gary T. Leavens Robert Dyer Foundations of.
Concern Architecture View and Aspect-Oriented Design Mika Katara and Shmuel Katz Tampere U. T. Technion, Haifa.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Alloy-based Lightweight Verification for Aspect-oriented Architecture Naoyasu Ubayashi(Kyushu Institute of Technology) Yuki Sato(Kyushu Institute of Technology)
Ch. 5 Ch. 51 jcmt Summer 2003Programming Languages CSE3302 Programming Languages (more notes) Summer 2003 Dr. Carter Tiernan.
1 Deriving Refactorings for AspectJ Leonardo Cole Paulo Borba Informatics Center Federal University of Pernambuco Brazil.
OOP Review CS 124.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
AOSD'04, Lancaster, UK 1 Remote Pointcut - A Language Construct for Distributed AOP Muga Nishizawa (Tokyo Tech) Shigeru Chiba (Tokyo Tech) Michiaki Tatsubori.
AOP/cross-cutting What is an aspect?. An aspect is a modular unit that cross-cuts other modular units. What means cross-cutting? Apply AOP to AOP. Tease.
SCoPE: an AspectJ Compiler for Supporting User-Defined Analysis-Based Pointcuts Tomoyuki Aotani Hidehiko Masuhara
Connecting Architecture Reconstruction Frameworks Ivan Bowman, Michael Godfrey, Ric Holt Software Architecture Group University of Waterloo CoSET ‘99 May.
Aspect-Oriented Software Development (AOSD)
1 Aspectual Caml an Aspect-Oriented Functional Language Hideaki Tatsuzawa Hidehiko Masuhara Akinori Yonezawa University of Tokyo.
Procedure Definitions and Semantics Procedures support control abstraction in programming languages. In most programming languages, a procedure is defined.
DESIGN PROCESS AND CONCEPTS. Design process s/w design is an iterative process through which requirements are translated into a “blueprint” for constructing.
Design Concepts ch-8
Software Engineering Lecture 7
SysML v2 Formalism: Requirements & Benefits
Closures and Streams cs784(Prasad) L11Clos
Subprograms and Programmer Defined Data Type
Need for the subject.
Programming Languages and Paradigms
AspectAda Aspect-Oriented Programming for Ada95
Aspect Oriented Software Design
Presentation transcript:

Aspect-Oriented Action Semantics Descriptions Luis Menezes University of Pernambuco

Agenda Action Semantics Action Semantics Aspect-oriented Programming Aspect-oriented Programming Aspect-oriented Action Semantics Aspect-oriented Action Semantics Conclusions Conclusions

Action Semantics Formalism to describe programming languages Formalism to describe programming languages Action Notation Action Notation concepts of programming languages concepts of programming languages Based on English terms (intuitive) Based on English terms (intuitive) Hides the modeled concepts complexity Hides the modeled concepts complexity

Action Semantics Examples of actions: Examples of actions: | give 1 then | give product(2,the given integer) | bind “x” to 10 hence | give sum(1,the integer bound to “x”) | allocate a cell then | store 10 in the given cell

Action Semantics Descriptions Originally AS descriptions are formed by: Originally AS descriptions are formed by: Abstract Syntax Abstract Syntax Semantic Functions Semantic Functions Semantic Entities Semantic Entities This organization separates the description of each PL concept in these modules. This organization separates the description of each PL concept in these modules.

Modular Extensions Proposed to increase the modularity of AS descriptions Proposed to increase the modularity of AS descriptions Object Oriented AS, Component AS, Modular AS Object Oriented AS, Component AS, Modular AS Descriptions formed by a set of language elements Descriptions formed by a set of language elements Each element has syntax and semantics. Each element has syntax and semantics. Facilitates the identification where the PL elements are defined. Facilitates the identification where the PL elements are defined.

Syntax-less Concepts Action Semantics descriptions translates syntactical elements into action notation. Action Semantics descriptions translates syntactical elements into action notation. Some programming language concepts are not represented by textual code in programs. Some programming language concepts are not represented by textual code in programs. For example: For example: The code: The code: f(1 + x) / y f(1 + x) / y can be used by lazy or eager programming language can be used by lazy or eager programming language Action Semantics Descriptions can not isolate their descriptions in separated modules Action Semantics Descriptions can not isolate their descriptions in separated modules The semantics is described inside other features semantics The semantics is described inside other features semantics

Example Expressions language: Expressions language: component Constant is Exp where syntax = [[ n:number ]] syntax = [[ n:number ]] semantics = give n semantics = give n component Sum is Exp where syntax = [[ a:Expression “+” b:Expression ]] syntax = [[ a:Expression “+” b:Expression ]] semantics = semantics = (evaluate a and then evaluate b) (evaluate a and then evaluate b) then then give sum of them give sum of them

Example Lazy Expressions Language: Lazy Expressions Language: component LazyConstant is Exp where syntax = [[ number ]] syntax = [[ number ]] semantics = give abstraction of give n semantics = give abstraction of give n component LazySum is Exp where syntax = [[ a:Expression “+” b:Expression ]] syntax = [[ a:Expression “+” b:Expression ]] semantics = semantics = give abstraction of ( give abstraction of ( (evaluate a and then evaluate b) (evaluate a and then evaluate b) then then (enact the given abstraction # 1 and then enact the given abstraction #2) (enact the given abstraction # 1 and then enact the given abstraction #2) then then give sum of them give sum of them )

Traditional object-oriented system developing has a similar problem….

Crosscutting Concern Crosscutting concern is a system feature that affects other concerns Crosscutting concern is a system feature that affects other concerns They can not be implemented in a separated module They can not be implemented in a separated module Difficult to insert/remove in complex systems Difficult to insert/remove in complex systems

Crosscutting Concern Example: Remote Databases: Example: Remote Databases: void transfer(Account src, Account dest, int amount) { if (!src.avaliable(amount)) if (!src.avaliable(amount)) throw new TransferError(); throw new TransferError(); src.whitdraw(amount); src.whitdraw(amount); dest.deposit(amount); dest.deposit(amount);}

Crosscutting Concern Example: Remote Databases Example: Remote Databases void transfer(Account src, Account dest, int amount) { try { try { DataBase d = connect(); DataBase d = connect(); d.openTransaction(); d.openTransaction(); if (!src.avaliable(amount)) if (!src.avaliable(amount)) throw new TransferError(); throw new TransferError(); d.rpc(whitdraw,src,amount); d.rpc(whitdraw,src,amount); d.rpc(deposit,dest,amount); d.rpc(deposit,dest,amount); d.closeTransaction(); d.closeTransaction(); } catch (CommunicationError e) { } catch (CommunicationError e) { d.undo(); d.undo(); throw new TransferError(); throw new TransferError(); }}

Aspect-oriented Programming Methodology designed to modularize the definition of crosscutting concerns Methodology designed to modularize the definition of crosscutting concerns Aspects: Aspects: Identify points in the system code Identify points in the system code Specify how these points are affected by the crosscutting concern implementation Specify how these points are affected by the crosscutting concern implementation Weaving Operation Weaving Operation Perform the modifications described by aspects Perform the modifications described by aspects

Weaving Operation void transfer(Account src, Account dest, int amount) { if (!src.avaliable(amount)) if (!src.avaliable(amount)) throw new TransferError(); throw new TransferError(); src.whitdraw(amount); src.whitdraw(amount); dest.deposit(amount); dest.deposit(amount);} aspect RemoteDataBase { ….. } Weaving void transfer(Account src, Account dest, int amount) { try { try { DataBase d = connect(); DataBase d = connect(); d.openTransaction(); d.openTransaction(); if (!src.avaliable(amount)) if (!src.avaliable(amount)) throw new TransferError(); throw new TransferError(); d.rpc(whitdraw,src,amount); d.rpc(whitdraw,src,amount); d.rpc(deposit,dest,amount); d.rpc(deposit,dest,amount); d.closeTransaction(); d.closeTransaction(); } catch (CommunicationError e) { } catch (CommunicationError e) { d.undo(); d.undo(); throw new TransferError(); throw new TransferError(); }}

Aspect-oriented Action Semantics Descriptions Motivation: Motivation: Use aspects to improve the modularity of action semantics descriptions Use aspects to improve the modularity of action semantics descriptions Operators designed to support aspect- oriented concepts in action semantics Operators designed to support aspect- oriented concepts in action semantics

Advices Specifies a modification in the specification Specifies a modification in the specification An advice can: An advice can: Modify the whole component semantics Modify the whole component semantics change semantics from x to y change semantics from x to y Rewrite a subterm inside the component semantics Rewrite a subterm inside the component semantics rewrite t 1 to t 2 rewrite t 1 to t 2

Advices component Constant is Exp where syntax = [[ n:number ]] semantics = give n aspect A { change semantics x to | complete and then | x } Weaving component Constant is Exp where syntax [[ n:number ]] semantics | complete and then | give n

Pointcuts Constrains the advices Constrains the advices Examples of pointcuts: Examples of pointcuts: The advice acts in specific components The advice acts in specific components inside c do a The advice needs a runtime condition to be enabled. The advice needs a runtime condition to be enabled. a when c

Advices component Constant is Exp where syntax = [[ n:number ]] semantics = give n component Identifier is Exp where syntax = [[ i:Identifier ]] semantic = give the integer bound to i aspect A { inside Identifier change semantics x to | complete and then | x } Weaving component Constant is Exp where syntax = [[ n:number ]] semantics = give n component Identifier is Exp where syntax = [[ i:Identifier ]] semantic = | complete then | give the integer bound to i

Example 1 Lazy Evaluation Aspect compoent Constant is Exp where syntax = [[ number ]] syntax = [[ number ]] semantics = give closure abstraction of give n semantics = give closure abstraction of give n component Sum is Exp where syntax = [[ a:Expression “+” b:Expression ]] syntax = [[ a:Expression “+” b:Expression ]] semantics = semantics = give closure abstraction of ( give closure abstraction of ( (evaluate a and then evaluate b) (evaluate a and then evaluate b) then then (enact the given abstraction # 1 and then (enact the given abstraction # 1 and then enact the given abstraction #2) enact the given abstraction #2) then then give sum of them give sum of them ) Advice 1: Expressions gives functions instead values

Example 1 Lazy Evaluation Aspect compoent Constant is Exp where syntax = [[ number ]] syntax = [[ number ]] semantics = give closure abstraction of give n semantics = give closure abstraction of give n component Sum is Exp where syntax = [[ a:Expression “+” b:Expression ]] syntax = [[ a:Expression “+” b:Expression ]] semantics = semantics = give closure abstraction of ( give closure abstraction of ( (evaluate a and then evaluate b) (evaluate a and then evaluate b) then then (enact the given abstraction # 1 and then (enact the given abstraction # 1 and then enact the given abstraction #2) enact the given abstraction #2) then then give sum of them give sum of them ) Advice 1: Inside Exp do change semantics from x to give closure abstraction of x

Example 1 Lazy Evaluation Aspect compoent Constant is Exp where syntax = [[ number ]] syntax = [[ number ]] semantics = give closure abstraction of give n semantics = give closure abstraction of give n component Sum is Exp where syntax = [[ a:Expression “+” b:Expression ]] syntax = [[ a:Expression “+” b:Expression ]] semantics = semantics = give closure abstraction of ( give closure abstraction of ( (evaluate a and then evaluate b) (evaluate a and then evaluate b) then then (enact the given abstraction # 1 and then (enact the given abstraction # 1 and then enact the given abstraction #2) enact the given abstraction #2) then then give sum of them give sum of them ) Advice 2: Evaluate the abstraction before to execute data operations

Example 1 Lazy Evaluation Aspect compoent Constant is Exp where syntax = [[ number ]] syntax = [[ number ]] semantics = give closure abstraction of give n semantics = give closure abstraction of give n component Sum is Exp where syntax = [[ a:Expression “+” b:Expression ]] syntax = [[ a:Expression “+” b:Expression ]] semantics = semantics = give closure abstraction of ( give closure abstraction of ( (evaluate a and then evaluate b) (evaluate a and then evaluate b) then then (enact the given abstraction # 1 and then (enact the given abstraction # 1 and then enact the given abstraction #2) enact the given abstraction #2) then then give sum of them give sum of them ) Advice 2: inside Exp do rewrite give op(a) to evaluateLazyData in a then give op(them)

Example 1 Lazy Evaluation Aspect compoent Constant is Exp where syntax = [[ number ]] syntax = [[ number ]] semantics = give n semantics = give n component Sum is Exp where syntax = [[ a:Expression “+” b:Expression ]] syntax = [[ a:Expression “+” b:Expression ]] semantics = semantics = (evaluate a and then evaluate b) (evaluate a and then evaluate b) then then give sum of them give sum of them aspect LazyEvaluation { Inside Exp do change semantics from x to give closure abstraction of x inside Exp do rewrite give op(a) to evaluateLazyData in a then give op(them)} weaving Lazy Expressions Language

Example 2 Static x Dynamic Binding Static Bindings Static Bindings component SB_FDecl is Decl where syntax [[ i:Id “()” c:Com ]] syntax [[ i:Id “()” c:Com ]] semantics semantics bind i to closure abstraction of bind i to closure abstraction of | semantics of c | semantics of c component SB_FCall is Com where syntax [[ i :Id “()” ]] syntax [[ i :Id “()” ]] semantics semantics enact the abstraction bound to i enact the abstraction bound to i Dynamic Bindings Dynamic Bindings component DB_FDecl is Decl where syntax [[ i:Id “()” c:Com ]] syntax [[ i:Id “()” c:Com ]] semantics semantics bind i to abstraction of bind i to abstraction of | semantics of c | semantics of c component DB_FCall is Com where syntax [[ i :Id “()” ]] syntax [[ i :Id “()” ]] semantics semantics enact closure the abstraction bound to i enact closure the abstraction bound to i aspect StaBind { rewrite abstraction of x to closure abstraction of x } aspect DynBind { rewrite enact ~x to enact closure ~x }

Example 2 Static x Dynamic Binding component FDecl is Decl where syntax [[ i:Id “()” c:Com ]] semantics bind i to abstraction of | semantics of c component FCall is Com where syntax [[ i :Id “() ]] semantics enact the abstraction bound to i aspect StaBind { rewrite abstraction of x to closure abstraction of x } aspect DynBind { rewrite enact ~x to enact closure ~x } weaving Language with Static Bindings Language with Dynamic Bindings

Conclusions Aspects are useful to describe some programming language concepts improve the modularity describe Aspects are useful to describe some programming language concepts improve the modularity describe Component libraries become more generic Component libraries become more generic Future research in this topic includes Future research in this topic includes Implementation of tools Implementation of tools Define new aspect operators and applications to programming language research Define new aspect operators and applications to programming language research Design an aspect-oriented library of PL concepts Design an aspect-oriented library of PL concepts

Aspect-Oriented Action Semantics Descriptions Luis Menezes University of Pernambuco