Aspect-Oriented Software Development (AOSD) Tutorial #4 Categories of Aspects.

Slides:



Advertisements
Similar presentations
CSCI 160 Midterm Review Rasanjalee DM.
Advertisements

1 Modular Verification of Strongly Invasive Aspects Authors: Emilia Katz, Shmuel Katz The Technion.
Aspect-Oriented Software Development (AOSD) Tutorial #10 Interference among Aspects.
Java.sun.com/javaone/sf | 2004 JavaOne SM Conference | Session BUS JavaOne 2004 What is AOP? Gregor Kiczales AspectMentor.com and University of.
Mock test review Revision of Activity Diagrams for Loops,
CSE 2501 Review Declaring a variable allocates space for the type of datum it is to store int x; // allocates space for an int int *px; // allocates space.
Aspect-Oriented Software Development (AOSD) Tutorial #2 AspectJ Basics.
Aspect-Oriented Software Development (AOSD) Tutorial #10 Interference among Aspects.
Aspect-Oriented Software Development (AOSD) Tutorial #5 Categories of Aspects – contd.; LTL properties formalization; Assume – guarantee specifications.
Aspect-Oriented Software Development (AOSD) Tutorial #4 Categories of Aspects.
Introduction to Computers and Programming Lecture 8: More Loops New York University.
Aspect-Oriented Software Development (AOSD) Tutorial #7 Assume – guarantee specifications; EAOP.
Aspect-Oriented Software Development (AOSD) Tutorial #5 Categories of Aspects – contd.; LTL properties formalization.
Aspect-Oriented Software Development (AOSD) Tutorial #8 Composition Filters.
Random (1) Random class contains a method to generate random numbers of integer and double type Note: before using Random class, you should add following.
Aspect-Oriented Software Development (236601) 1 Home Assignment (what, where and when)
Aspect-Oriented Software Development (AOSD) Tutorial #2 AspectJ Basics.
Rigorous Fault Tolerance Using Aspects and Formal Methods Shmuel Katz Computer Science Department The Technion Haifa, Israel
Aspect-Oriented Software Development (AOSD) Additional Tutorial.
Aspect-Oriented Software Development (AOSD) Tutorial #6 Categories of Aspects – contd.; LTL properties formalization; Assume – guarantee specifications.
Aspect-Oriented Software Development (AOSD) Tutorial #3 AspectJ - continued.
Aspect-Oriented Software Development (236608) 1 Aspect-Oriented Software Development (AOSD) Tutorial #1 Course site :
Aspect-Oriented Software Development (AOSD) Tutorial #9 Modular Verification of Aspects.
Aspect-Oriented Software Development (AOSD) Tutorial #5 Categories of Aspects – contd.; LTL properties formalization.
Aspect-Oriented Software Development (AOSD) Tutorial #7 Assume – guarantee specifications; EAOP.
Aspect-Oriented Software Development (AOSD) Tutorial #3 AspectJ - continued.
Aspect-Oriented Software Development (AOSD) Tutorial #9 Modular Verification of Aspects.
CMSC 104, Version 8/061L22Arrays1.ppt Arrays, Part 1 of 2 Topics Definition of a Data Structure Definition of an Array Array Declaration, Initialization,
Options for User Input Options for getting information from the user –Write event-driven code Con: requires a significant amount of new code to set-up.
16-Aug-15 Java Puzzlers From the book Java Puzzlers by Joshua Bloch and Neal Gafter.
CS 46B: Introduction to Data Structures July 30 Class Meeting Department of Computer Science San Jose State University Summer 2015 Instructor: Ron Mak.
11 Values and References Chapter Objectives You will be able to: Describe and compare value types and reference types. Write programs that use variables.
CMSC 202 Interfaces. 11/20102 Classes and Methods When a class defines its methods as public, it describes how the class user interacts with the method.
Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 19 Clicker Questions November 3, 2009.
Object Oriented Programming Concepts OOP – reasoning about a program as a set of objects rather than as a set of actions Object – a programming entity.
Exception Handling. Outline What is an Exception How to use exceptions catch ing throw ing Extending the Exception class Declaring using the throws clause.
Spring 2008 Mark Fontenot CSE 1341 Principles of Computer Science I Note Set 2.
Copyright 2008 by Pearson Education Building Java Programs Chapter 8 Lecture 8-3: Encapsulation, this reading: self-checks: #13-17 exercises:
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
Kiczales and Mezini - FOAL AOP and Modular Reasoning [ICSE05] Start with first-principles definition of modularity and modular reasoning –localization,
AOSD1 Aspect-Oriented Software Design Karl Lieberherr Theo Skotiniotis.
Mathematical Calculations in Java Mrs. G. Chapman.
Loops, Methods, Classes Using Loops, Defining and Using Methods, Using API Classes, Exceptions, Defining Classes Bogomil Dimitrov Technical Trainer Software.
Aspect-Oriented Programming and Modular Reasoning G. KiczalesM. Mezini Presented by Alex Berendeyev.
Chapter 2 topics Concept # on Java Subset Required for AP Exam print and println10. Testing of output is restricted to System.out.print and System.out.println.
Alloy-based Lightweight Verification for Aspect-oriented Architecture Naoyasu Ubayashi(Kyushu Institute of Technology) Yuki Sato(Kyushu Institute of Technology)
In order for Cardholders to enroll in the internet Payment Center tool, they need to copy and paste the following URL in the address bar:
AOP and observer pattern. Design pattern General reusable solution to a commonly occurring problem in software design Not a finished design that can be.
Static?. Static Not dynamic class Widget { static int s; int d; // dynamic // or instance // variable }
CS305j Introduction to Computing Classes II 1 Topic 24 Classes Part II "Object-oriented programming as it emerged in Simula 67 allows software structure.
1 Incremental Analysis of Interference Among Aspects Authors: Emilia Katz, Shmuel Katz The Technion.
CSE 143 Lecture 4 More ArrayIntList : Pre/postconditions; exceptions; testing reading: slides created by Marty Stepp and Hélène Martin
Building Java Programs Chapter 15 Lecture 15-2: testing ArrayIntList; pre/post conditions and exceptions reading:
1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
Array Size Arrays use static allocation of space. That is, when the array is created, we must specify the size of the array, e.g., int[] grades = new int[100];
CS 106 Introduction to Computer Science I 09 / 10 / 2007 Instructor: Michael Eckmann.
Methods What is a method? Main Method the main method is where a stand alone Java program normally begins execution common compile error, trying.
Introduction to programming in java Lecture 22 Arrays – Part 2 and Assignment No. 3.
Loops, Methods, Classes Using Loops, Defining and Using Methods, Using API Classes, Exceptions, Defining Classes Svetlin Nakov Technical Trainer
Copyright 2010 by Pearson Education Building Java Programs Chapter 8 Lecture 8-3: Constructors; Encapsulation reading: self-checks: #13-18,
Exceptions Part II. What you need to know Last time –What happens when an exception is thrown –What are your choices for handling exceptions –The different.
Classes and Objects Introduced
Primitive Data, Variables, Loops (Maybe)
CSC 113 Tutorial QUIZ I.
Lecture 5: For Loops Building Java Programs: A Back to Basics Approach
Generics, Lambdas, Reflections
Scope of variables class scopeofvars {
CSC 111 Exam 3 Review Fall 2005.
Building Java Programs
Presentation transcript:

Aspect-Oriented Software Development (AOSD) Tutorial #4 Categories of Aspects

Aspect-Oriented Software Development (236608) 2 Today: Categories of Aspects Categories - intuition Determining aspect category Safety and Liveness properties Base properties preservation (guaranteed and occasional) Examples

Aspect-Oriented Software Development (236608) 3 Aspect Categories – Intuition(1) Projection of S+A on S : the same as S (except for stuttering, maybe) A - spectative (computations tree of) S

Aspect-Oriented Software Development (236608) 4 Aspect Categories - Intuition(2) A - regulative Projection of S+A on S : Edges pruned S

Aspect-Oriented Software Development (236608) 5 Aspect Categories - Intuition(3) A – weakly invasive S Projection of S+A on S : Edges added

Aspect-Oriented Software Development (236608) 6 Aspect Categories - Intuition(4) A – strongly invasive S Projection of S+A on S : States added

Aspect-Oriented Software Development (236608) 7 Example Class: Point - reminder class Point { private int x, y; public Point(int x, int y) { this.x = x; this.y = y; } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } public void MoveTo(Point p) {setX(p.x); setY(p.y); } public int getX() { return x; } public int getY() { return y; } }

Aspect-Oriented Software Development (236608) 8 “Who am I?” Aspect 1: Positive quarter check. After each change in points, check whether they are in the positive quarter of the space pointcut movePoint … pointcut createPoint … after(Point pt, int newArg) returning(): movePoint(pt, newArg) { if( newArg < 0) System.out.println( “…” ); } after(int x, int y) returning(): createPoint(x, y) { if( x < 0 || y < 0) System.out.println( “…” ); }

Aspect-Oriented Software Development (236608) 9 “Who am I?” – contd. Aspect 2: Positive quarter enforce. Make sure all the points are in the positive quarter of the space … void around(Point pt, int newArg): movePoint(pt, newArg) { if( newArg >= 0) proceed(pt, newArg); else System.out.println( “…” ); } Point around(int x, int y) : createPoint(x, y) { if( x < 0) { x=0; System.out.println( “…” );} if( y < 0) { y=0; System.out.println( “…” );} proceed(x,y); }

Aspect-Oriented Software Development (236608) 10 “Who am I?” – contd. Aspect3: Adding names to points private String Point.name = ""; public String Point.getName() {return name;} public void Point.setName(String newName) {name = newName;} … pointcut moved(Point pt): target(pt) && (call(void setX(int)) || call(void setY(int))); after(Point pt) returning: moved (pt) { System.out.println("Point "+pt.getName()+" moved to ("+pt.getX()+","+pt.getY()+")"); }

Aspect-Oriented Software Development (236608) 11 “Who am I?” – contd. aspect RegistrationProtection { pointcut register(): call(void Registry.register(FigureElement)); pointcut canRegister(): withincode(static *FigureElement.make*(..)); declare error: register() && !canRegister(): "Illegal call " } Aspect 4: Contract enforcement. Only the factory methods can add an element to the registry of figure elements.

Aspect-Oriented Software Development (236608) 12 Example: Rational Exam (reminder) private void doExam() { while (true) { r1 = randomRational(); r2 = randomRational(); result = r1.add(r2); answer = getAnswer(r1, r2); if (answer == null) break; checkAnswer(answer, result); } public static void main(String[] args) { RationalExam exam = new RationalExam(); exam.doExam(); } The system generates and checks online exams for students with simple arithmetic exercises for fractions RationalExam class: initiates exams, generates questions, accepts answers, checks answers

Aspect-Oriented Software Development (236608) 13 “Who am I?” – contd. Aspect 5: User-created exceptions logger (loggs the exceptions to a file) Aspect 6: Multiplication (provides the possibility to ask questions about multiplication)

Aspect-Oriented Software Development (236608) 14 “Who am I?” – contd. Aspect 7: Questions “normalization”. After a question is created, reduces the fractions appearing in it. Aspect 8: Age restriction. Only students under age 8 can do the exam

Aspect-Oriented Software Development (236608) 15 “Who am I?” – contd. Aspect 9: Grading aspect – during the exam, the percentage of the correct answers is counted. After the exam is finished, the grade is stored. Aspect 10: After the grading aspect is added to the system, the teacher is given a possibility to give a factor to the students.

Aspect-Oriented Software Development (236608) 16 Safety and Liveness Properties Safety property – “Bad things do not happen”: ψ → G φ (“at every state φ holds”) Liveness property – “Good things happen”. Every property that is not safety. For example, F φ (“φ holds at some future state”) [LTL past formula φ holds at state s iff …… “good” computation prefix (satisfies φ) state s includes s !

Aspect-Oriented Software Development (236608) 17 Examples : Safety and Liveness “If a message is sent, it will be received” “ Passwords are only sent encrypted” “Every received message is immediately processed”

Aspect-Oriented Software Development (236608) 18 Examples : Safety and Liveness (2) “The semaphore is free infinitely many times during each computation” “When the computation is finished, the system becomes idle, and stays idle forever” “Login is permitted only if the password has been verified”

Aspect-Oriented Software Development (236608) 19 Base Properties Preservation?(1) p p, q q q, t q t p, t φ 1 = G (p → X q) φ 2 = G (r → X t) join-points: r = true r, q, t r t r r r Spectative aspect; “X” properties

Aspect-Oriented Software Development (236608) 20 Base Properties Preservation(2) p p, r q q p, t φ 1 = G (p → F q) φ 2 = G (r → F t) r q r t p Regulative aspect; general liveness properties advice effect

Aspect-Oriented Software Development (236608) 21 Rational Exam System Properties “After a user answers a question, the system performs correctness check and prints out the result” “If an answer is a and the arguments - r 1 and r 2, the correctness check will result in “true” iff a = r 1 + r 2 ”

Aspect-Oriented Software Development (236608) 22 Rational Exam – Properties Preservation φ 1 = G( ((getAnswer()= a) ⋀ (a≠null)) → F( checkAnswer(a,result) ⋀ (F print(checkAnswer(a,result))))) φ 2 =G ( (checkAnswer(a,res)→(res=r 1 + r 2 )) ⋀ (checkAnswer(a, res)↔(a=res))) φ1φ1 φ2φ2 Exceptions logging Multiplication Normalization Age restriction Grading Factor