Inheritance Anomalies

Slides:



Advertisements
Similar presentations
Lab1 Lab 1: CSG 711: Programming to Structure Karl Lieberherr.
Advertisements

Chapter 6 Process Synchronization Bernard Chen Spring 2007.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores.
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
ASTA Aspect Software Testing Assistant Juha Gustafsson, Juha Taina, Jukka Viljamaa University of Helsinki.
Secure Systems Research Group - FAU Aspect Oriented Programming Carlos Oviedo Secure Systems Research Group.
Overview of AspectJ Aspect Oriented Software Development Seminar Technion presented by Oren Mishali.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
ASPECT ORIENTED SOFTWARE DEVELOPMENT Prepared By: Ebru Doğan.
Chair of Software Engineering 1 Concurrent Object-Oriented Programming Arnaud Bailly, Bertrand Meyer and Volkan Arslan.
University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales.
Developing Adaptive J2ME Applications Using AspectJ Ayla Débora and Paulo Borba {add, Centro de Informática - UFPE.
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.
Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)
Aspect Oriented Programming Scott Nykl CSSE 411 Senior Seminar.
What is “model transformation”? Distinction between source and target Source may be same as target May be multiple sources, or targets Reaching a fixed.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
POSL (Principles of Software Languages) Gr. Kyushu Institute of Technology, Japan Pointcut-based Architectural Interface.
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.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
1 An Aspect-Oriented Implementation Method Sérgio Soares CIn – UFPE Orientador: Paulo Borba.
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.
Architectural Point Mapping for Design Traceability Naoyasu Ubayashi and Yasutaka Kamei Kyushu University, Japan March 26, 2012 FOAL 2012 (AOSD Workshop)
Adaptive Software Kevin Cella Graduate Seminar 02/04/2005.
Inter-Type Declarations in AspectJ Awais Rashid Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
1 Deriving Refactorings for AspectJ Leonardo Cole Paulo Borba Informatics Center Federal University of Pernambuco Brazil.
Side effects A side effect is anything that happens in a method other than computing and/or returning a value. Example: public class hello { public int.
R R R A Brief Introduction to Aspect-Oriented Programming.
COMP319 REVISION © University of LiverpoolCOMP 319slide 1.
Process Synchronization. Objectives To introduce the critical-section problem, whose solutions can be used to ensure the consistency of shared data To.
Caching: An Optimization Aspect. Class Diagram for Base Item +name : String +check() : int Simple +weight : int +check() : int Container +capacity : int.
Features of AOP languages AOP languages have the following main elements: –a join point model (JPM) wrt base PL –a specification language for expressing.
Coming up A quick word about abstract How a class interfaces
CS703 - Advanced Operating Systems
Software Life Cycle “What happens in the ‘life’ of software”
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
CMPE212 – Stuff… Assn 3 due and Quiz 2 in the lab next week.
Presented by Igor Ivković
Can perform actions and provide communication
Aspect-Oriented Programming
ADAPTIVE PROGRAMMING Sezen ERDEM December 2005.
Can perform actions and provide communication
Java Programming Language
Object-Oriented Programming
A Brief Introduction to Aspect-Oriented Programming
Chapter 1: Computer Systems
Automatic Derivation, Integration and Verification
Process Synchronization
Can perform actions and provide communication
Critical section problem
Grades.
Structuring Adaptive Applications using AspectJ and AOM
Better Separation of Crosscutting Concerns with Aspectual Components
Chapter 6: Process Synchronization
Aspect-oriented programming
COP 3330 Object-oriented Programming in C++
Object-Oriented Programming
Options for Demeter intergration into AspectJ
CSE 153 Design of Operating Systems Winter 19
AspectAda Aspect-Oriented Programming for Ada95
Click Summary Value Button to Show Source of Integral or Time
Presented by Igor Ivković
Winter 2019 CMPE212 5/25/2019 CMPE212 – Reminders
Aspect Oriented Software Design
Adaptive Programming in JAsCo
Don Porter Portions courtesy Emmett Witchel
Presentation transcript:

Inheritance Anomalies Synchronization of concurrent objects and inheritance. Key paper: [Matsuoka93] Analysis of Inheritance Anomalies in OOPL. “When coding a base class (…) the code related to concurrency control cannot be effectively inherited and/or refined in a subclass without non-trivial redefinitions of the methods implementation.” [C. Lopes PhD] Laura Benitez COM3362 Winter'02

Separation of core and synchronization behaviors (1) Synchronization constraint: In a certain state an object can accept only certain methods to maintain its internal integrity. Bounded-Buffer object: Get(): if buffer not empty. Put(): if buffer not full. Laura Benitez COM3362 Winter'02

Separation of core and synchronization behaviors (2) Synchronization code: Portion of code where the synchronization behavior is controlled. It must always be consistent with the synchronization constraint. Laura Benitez COM3362 Winter'02

When are Inheritance Anomalies found? Partition of acceptable states (Get2()) History-only sensitiveness of acceptable states (Gget(), DoubleClick() ) Modification of acceptable states. (Lock) Laura Benitez COM3362 Winter'02

How does AOP helps? AO program OO program Core behavior Synchronization behavior Other concern- related behavior Laura Benitez COM3362 Winter'02

Double click No inheritance anomalies! History-only related behavior Mouse MouseWDc 2-button 3-button Wheel LeftClick(); RightClick(); LeftPress(); LeftRelease(); WheelClick(); WheelRollUp(); WheelRollDown(); MiddleClick(); Mouse MouseWDc 2-button 3-button Wheel LeftClick(); RightClick(); LeftPress(); LeftRelease(); WheelClick(); WheelRollUp(); WheelRollDown(); MiddleClick(); Laura Benitez COM3362 Winter'02

Double clicks (1) Laura Benitez COM3362 Winter'02 aspect DoubleClick {   private String MouseWDc.prevOp; private String MouseWDc.get_prevOp() { return prevOp; } private void MouseWDc.set_prevOp(String op) {prevOp=op;} // very specific pointcuts allow us keeping the advice simple pointcut pc(MouseWDc m): (call(* *(..))) && (!call(* get*(..))) && (!call(* set*(..))) && target(m) && !within(DoubleClick); pointcut pcTB(TwoButton m): call(* *Click(..)) && target(m); pointcut pcWM(WheelMouse m): (call(* LeftClick(..)) || call(* WheelClick(..))) && target(m); after(MouseWDc m): pc(m) { // common behavior for doubleclicks String curr_op = thisJoinPoint.getSignature().toShortString(); if(m.get_prevOp()!=null && m.get_prevOp().equals(curr_op)) { if (curr_op.indexOf("LeftClick")!=-1) System.out.println("Double LeftClick detected"); } else { if ((curr_op.indexOf("LeftClick")==-1) && (curr_op.indexOf("RightClick")==-1) && (curr_op.indexOf("WheelClick")==-1)) { m.set_prevOp(curr_op); } Laura Benitez COM3362 Winter'02

Double clicks (2) } // end of aspect Laura Benitez COM3362 Winter'02 after (TwoButton m): pcTB(m) { // exclusive behavior for TwoButton Mice String curr_op = thisJoinPoint.getSignature().toShortString(); if(m.get_prevOp()!=null && m.get_prevOp().equals(curr_op)) { if (curr_op.indexOf("RightClick")!=-1) System.out.println("Double RightClick detected"); } else { m.set_prevOp(curr_op); } after (WheelMouse m): pcWM(m) { // exclusive behavior for Wheel Mice if (curr_op.indexOf("WheelClick")!=-1) System.out.println("Double WheelClick detected"); } // end of aspect Laura Benitez COM3362 Winter'02

Advantages of using AOP No code tangling caused by synchronization concerns No inheritance anomalies associated with concurrency ! Higher level of reusability. Laura Benitez COM3362 Winter'02

Solutions found DJ Visitor to solve the Mouse problem. Using AspectJ: Very specific pointcuts => simpler advice. General pointcuts => more elaborated advice Abstract aspects =>higher degree of reusability Too many abstraction levels make code difficult to follow. Open classes => incremental approach Laura Benitez COM3362 Winter'02

Comments Solutions are very dependent on the parser for the simulation language. Use AOP design has hardly been used instead of OOP design. Laura Benitez COM3362 Winter'02

Summary of best solutions Building from scratch: Use of AOP design and open classes Using AspectJ: Use abstract aspects for reusability Use fine grained definition of pointcuts Laura Benitez COM3362 Winter'02