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.
1 Software Testing and Quality Assurance Lecture 23 – JUnit Tutorial.
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 #4 Categories of Aspects.
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 #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.
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.
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.
©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 8: Testing and Debugging 1 Chapter 8 Testing and Debugging.
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.
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.
Mathematical Calculations in Java Mrs. C. Furman.
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.
Copyright 2010 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
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.
Application development with Java Lecture 21. Inheritance Subclasses Overriding Object class.
Interfaces An interface is like an extreme case of an abstract class – However, an interface is not a class – It is a type that can be satisfied by any.
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.
Comp1202: Conclusions Revision Session. Coming up Key Concepts - The Pillars HashMaps Exceptions The Exam Some Last Words.
Classes and Objects Introduced
Primitive Data, Variables, Loops (Maybe)
COMPUTER 2430 Object Oriented Programming and Data Structures I
class PrintOnetoTen { public static void main(String args[]) {
Building Java Programs
Scope of variables class scopeofvars {
CSE 142 Lecture Notes Defining New Types of Objects, cont'd.
CSC 111 Exam 3 Review Fall 2005.
Building Java Programs
Topic 29 classes and objects, part 3
Topic 29 classes and objects, part 3
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( “…” ); } spectative

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); } weakly invasive!

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()+")"); } spectative

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. regulative

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) spectative strongly invasive

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 weakly invasive regulative

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. spectative weakly invasive

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 ! ψ, φ – past LTL formulas

Aspect-Oriented Software Development (236608) 17 Examples : Safety and Liveness “If a message is sent, it will be received” G(msg_send → F msg_rec) => Liveness “ Passwords are only sent encrypted” G(psw_sent → encrypted) => Safety “Every received message is immediately processed” G(msg_rec → X msg_proc) => Liveness

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