Aspect Oriented Software Design

Slides:



Advertisements
Similar presentations
Monitoring Design Pattern Contracts Jason O. Hallstrom Clemson University SAVCBS 04 Workshop at ACM SIGSOFT 2004/FSE-12 Benjamin Tyler (Presenter) Ohio.
Advertisements

Awais Rashid, Steffen Zschaler
1 OBJECT-ORIENTED CONCEPTS. 2 What is an object?  An object is a software entity that mirrors the real world in some way.  A software object in OOP.
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
An Aspect-Oriented Approach For Web Application Access Control Presented by: Mohamed Hassan Carleton University Carleton University
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development.
Aspect Oriented Programming - AspectJ Radhika Rajput.
Secure Systems Research Group - FAU Aspect Oriented Programming Carlos Oviedo Secure Systems Research Group.
An Untyped Calculus of Aspect- Oriented Programs Radha Jagadeesan Alan Jeffrey James Riely DEPAUL UNIVERSITY, CHICAGO.
ASPECT ORIENTED SOFTWARE DEVELOPMENT Prepared By: Ebru Doğan.
University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales.
Unified Modeling (Part I) Overview of UML & Modeling
Rigorous Fault Tolerance Using Aspects and Formal Methods Shmuel Katz Computer Science Department The Technion Haifa, Israel
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
11 1 Object oriented DB (not in book) Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel Learning objectives: What.
1/19 Component Design On-demand Learning Series Software Engineering of Web Application - Principles of Good Component Design Hunan University, Software.
Towards Executable Aspect-Oriented UML Models 10th Int. Workshop on Aspect-Oriented Modeling (AOM), 6th Int. Conf. on Aspect-Oriented Software Development.
“Enhancing Reuse with Information Hiding” ITT Proceedings of the Workshop on Reusability in Programming, 1983 Reprinted in Software Reusability, Volume.
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.
Architecture-Based Runtime Software Evolution Peyman Oreizy, Nenad Medvidovic & Richard N. Taylor.
Demeter Interfaces: AP without Surprises Prof. Karl Lieberherr and Therapon Skotiniotis, Jeffrey Palm.
Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
Composing Adaptive Software Authors Philip K. McKinley, Seyed Masoud Sadjadi, Eric P. Kasten, Betty H.C. Cheng Presented by Ana Rodriguez June 21, 2006.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development 1.
Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, System and Software Engineering.
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.
Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer.
Aspect Oriented Programming Gülşah KARADUMAN.
Joel Phinney March 31, ◦ Concerns  Separation of Concerns, Tangled and Scattered Concerns, Cross-Cutting Concerns, Aspects ◦ Aspect-Oriented Software.
1 Introduction to Software Engineering Lecture 1.
1 The Modular Structure of Complex Systems Presented by: SeyedMasoud Sadjadi and Wei Zhu David L. Parnas, Paul C. Clement, and David M. Weiss ICSE 1984.
AOSD1 Aspect-Oriented Software Design Karl Lieberherr Theo Skotiniotis.
Software Engineering Prof. Ing. Ivo Vondrak, CSc. Dept. of Computer Science Technical University of Ostrava
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
Introduction Better Faster Cheaper (pick any two) On-going issue that continues to motivate research in software engineering Applications: –continue to.
Aspect-Oriented Programming An Introductory Presentation Mike Landi MSCS Candidate Union University.
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.
Aspect-Oriented Action Semantics Descriptions Luis Menezes University of Pernambuco
Abstraction ADTs, Information Hiding and Encapsulation.
Demeter Aspects We study techniques for the emerging area of Aspect-Oriented Software Development and focus on the following areas:  Aspectual Collaborations.
Chapter 8: Aspect Oriented Programming Omar Meqdadi SE 3860 Lecture 8 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
1 Modularity Analysis of Use Case Implementations Fernanda d’Amorim Advisor: Paulo Borba.
Aspect Oriented Programming Adlux Consultancy Services Pvt Ltd
Advanced Software Development Karl Lieberherr CSG 260 Fall Semester
R R R A Brief Introduction to Aspect-Oriented Programming.
Aspect-Oriented Software Development (AOSD)
L’origine dei mali: le dipendenze tra componenti Stefano Leli 14° Workshop DotNetMarche Venerdì 16 aprile
 The Object Oriented concepts was evolved for solving complex problems. Object- oriented software development started in the 1980s. Object-oriented design.
Sumant Tambe* Akshay Dabholkar Aniruddha Gokhale
Software Reuse ©Ian Sommerville 2006.
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Towards Effective Adaptive User Interfaces Design
Demeter Aspects Who We Are Aspectual Collaborations
Aspect-Oriented Programming
Implementation of the INFOD System using AOP
Subprograms and Programmer Defined Data Type
Chapter 20 Object-Oriented Analysis and Design
Need for the subject.
Better Separation of Crosscutting Concerns with Aspectual Components
SAMANVITHA RAMAYANAM 18TH FEBRUARY 2010 CPE 691
Aspect-oriented programming
AspectAda Aspect-Oriented Programming for Ada95
Agenda Software development (SD) & Software development methodologies (SDM) Orthogonal views of the software OOSD Methodology Why an Object Orientation?
UML  UML stands for Unified Modeling Language. It is a standard which is mainly used for creating object- oriented, meaningful documentation models for.
Refactoring the Aspectizable Interfaces: An Empirical Assessment
Presentation transcript:

Aspect Oriented Software Design Therapon Skotiniotis Karl Lieberherr Northeastern University Boston, MA 02115 USA 5/24/2019 ABB Workshop

The talk will cover .. The problem The solution The benefits “code tangling” The solution Better abstractions to provide advanced “Separation of Concerns” The benefits Higher code modularity Better code reuse Ease of program extensions/maintenance/understanding 5/24/2019 ABB Workshop

The problem Readers Writers Protocol Multiple Readers Single Writer class Book: // data Book() {Message = new StringBuffer("null");} public int write (String msg, int ip) { if ((ip % 10) > 0) return 0; else if (AuthClients < MaxAuthClients) { AuthClients++; if ((getAReaders() == 0) && (getAWriters() == 0)) { if(getWWriters() > 0 ) decrWWriters(); incrAWriters(); if (getWWriters() == 0) { Message.replace(0, Message.length(), msg); } if (getWWriters() > 0) synchronized (WQueue) { WriteQueue.notify(); else if (getWReaders() > 0) synchronized (ReadQueue){ ReadQueue.notify(); decrAWriters(); synchronized (AuthQueue) { AuthClients--; AuthQueue.notify(); return 1; else synchronized (WQueue) { WQueue.wait(); else synchronized (AuthQueue) { AuthQueue.wait(); } } Readers Writers Protocol Multiple Readers Single Writer Waiting Writers get priority Authentication required Enforcing the requirements Authentication Synchronization Scheduling Functionality 5/24/2019 ABB Workshop

Concerns and their Separation In Readers Writers Functionality read(), write() Authentication Yes, no Synchronization Resource available or not Scheduling Policy on who has priority to go next 5/24/2019 ABB Workshop

Concerns and their Separation (cont) In Readers Writers Functionality read(), write() Authentication Yes, no Synchronization Resource available or not Scheduling Policy on who has priority to go next Operation System Constraints 5/24/2019 ABB Workshop

Concerns and their Separation (cont) In OOP, functional decomposition has been performed along one dimension: component. Crosscutting concerns are not random properties Systematically repeated at different points within your code Affect the semantics and/or performance of your system AOSD proposes the means to encapsulate crosscutting concerns objects aspects 5/24/2019 ABB Workshop

Concerns and their Separation (cont) “Separation of Concerns” [Parnas 72] drives software development. A concern is a concept, realized as a unit of software. Each concern is addressed separately in isolation Each concern becomes a module keeping inter-module dependencies to the minimum “Do not talk to strangers” The Law Of Demeter There is no established methodology on how to achieve this principle. 5/24/2019 ABB Workshop

From this … Authentication Synchronization Scheduling Functionality class Book: // data Book() {Message = new StringBuffer("null");} public int write (String msg, int ip) { if ((ip % 10) > 0) return 0; else if (AuthClients < MaxAuthClients) { AuthClients++; if ((getAReaders() == 0) && (getAWriters() == 0)) { if(getWWriters() > 0 ) decrWWriters(); incrAWriters(); if (getWWriters() == 0) { Message.replace(0, Message.length(), msg); } if (getWWriters() > 0) synchronized (WQueue) { WriteQueue.notify(); else if (getWReaders() > 0) synchronized (ReadQueue){ ReadQueue.notify(); decrAWriters(); synchronized (AuthQueue) { AuthClients--; AuthQueue.notify(); return 1; else synchronized (WQueue) { WQueue.wait(); else synchronized (AuthQueue) { AuthQueue.wait(); } } Authentication Synchronization Scheduling Functionality 5/24/2019 ABB Workshop

… to this synchronized (AuthQueue) { Authentication Synchronization if (getWWriters() == 0) { } if (getWWriters() > 0) synchronized (WQueue) { WriteQueue.notify(); class Book: // data Book() {Message = new StringBuffer("null");} public int write (String msg, int ip) { Message.replace(0, Message.length(), msg); return 1; } if ((ip % 10) > 0) return 0; else if (AuthClients < MaxAuthClients) { AuthClients++; synchronized (AuthQueue) { AuthClients--; AuthQueue.notify(); } else synchronized (AuthQueue) { AuthQueue.wait(); if ((getAReaders() == 0) && (getAWriters() == 0)) { if(getWWriters() > 0 ) decrWWriters(); incrAWriters(); else if (getWReaders() > 0) synchronized (ReadQueue){ ReadQueue.notify(); } decrAWriters(); else synchronized (WQueue) { WQueue.wait(); Authentication Synchronization Scheduling Functionality 5/24/2019 ABB Workshop

Concerns and their Separation (cont) if (getWWriters() == 0) { } if (getWWriters() > 0) synchronized (WQueue) { WriteQueue.notify(); class Book: // data Book() {Message = new StringBuffer("null");} public int write (String msg, int ip) { Message.replace(0, Message.length(), msg); return 1; } if ((ip % 10) > 0) return 0; else if (AuthClients < MaxAuthClients) { AuthClients++; synchronized (AuthQueue) { AuthClients--; AuthQueue.notify(); } else synchronized (AuthQueue) { AuthQueue.wait(); Aspect Base Aspect if ((getAReaders() == 0) && (getAWriters() == 0)) { if(getWWriters() > 0 ) decrWWriters(); incrAWriters(); else if (getWReaders() > 0) synchronized (ReadQueue){ ReadQueue.notify(); } decrAWriters(); else synchronized (WQueue) { WQueue.wait(); Authentication Synchronization Scheduling Functionality Aspect 5/24/2019 ABB Workshop

Putting it all together The program needs to maintain the overall problem/solution semantics Code in aspects is only to be executed at specific execution points Control (ordering) at this execution points matters JoinPoint Model Provides the means to identify points within the execution to which aspectual code can be executed Weaving: Underlying AOSD tool performs the integration At JoinPoints as specified by your code Attaching code as specified by your Aspect The “mechanics” behind the JoinPoint make all the difference Static Vs Dynamic Expressiveness of JoinPoint definition language Aspect Code scope and execution capabilities 5/24/2019 ABB Workshop

Concerns and their Separation (cont) public int write (String msg, int ip) { before: if ((getAReaders() == 0) && (getAWriters() == 0)) { if(getWWriters() > 0 ) decrWWriters(); incrAWriters(); else if (getWReaders() > 0) synchronized (ReadQueue){ ReadQueue.notify(); } after: decrAWriters(); else synchronized (WQueue) { WQueue.wait(); before: if (getWWriters() == 0) { return true; } after: if (getWWriters() > 0) synchronized (WQueue) { WriteQueue.notify(); before: if (ip %10 == 0) { … } after: authenticated --; 5/24/2019 ABB Workshop

Concerns and their Separation (cont) pointcut: call(Book.write(…)); public int write (String msg, int ip) { before: if ((getAReaders() == 0) && (getAWriters() == 0)) { if(getWWriters() > 0 ) decrWWriters(); incrAWriters(); else if (getWReaders() > 0) synchronized (ReadQueue){ ReadQueue.notify(); } after: decrAWriters(); else synchronized (WQueue) { WQueue.wait(); before: if (getWWriters() == 0) { return true; } after: if (getWWriters() > 0) synchronized (WQueue) { WriteQueue.notify(); before: if (ip %10 == 0) { … } after: authenticated --; 5/24/2019 ABB Workshop

Concerns and their Separation (cont) JoinPoint pointcut: call(Book.write(…)); public int write (String msg, int ip) { before: if ((getAReaders() == 0) && (getAWriters() == 0)) { if(getWWriters() > 0 ) decrWWriters(); incrAWriters(); else if (getWReaders() > 0) synchronized (ReadQueue){ ReadQueue.notify(); } after: decrAWriters(); else synchronized (WQueue) { WQueue.wait(); before: if (getWWriters() == 0) { return true; } after: if (getWWriters() > 0) synchronized (WQueue) { WriteQueue.notify(); before: if (ip %10 == 0) { … } after: authenticated --; 5/24/2019 ABB Workshop

Concerns and their Separation (cont) pointcut: call(Book.write(…)); public int write (String msg, int ip) { 1 before: if ((getAReaders() == 0) && (getAWriters() == 0)) { if(getWWriters() > 0 ) decrWWriters(); incrAWriters(); else if (getWReaders() > 0) synchronized (ReadQueue){ ReadQueue.notify(); } after: decrAWriters(); else synchronized (WQueue) { WQueue.wait(); before: if (getWWriters() == 0) { return true; } after: if (getWWriters() > 0) synchronized (WQueue) { WriteQueue.notify(); before: if (ip %10 == 0) { … } after: authenticated --; 5/24/2019 ABB Workshop

Concerns and their Separation (cont) pointcut: call(Book.write(…)); public int write (String msg, int ip) { 2 before: if ((getAReaders() == 0) && (getAWriters() == 0)) { if(getWWriters() > 0 ) decrWWriters(); incrAWriters(); else if (getWReaders() > 0) synchronized (ReadQueue){ ReadQueue.notify(); } after: decrAWriters(); else synchronized (WQueue) { WQueue.wait(); before: if (getWWriters() == 0) { return true; } after: if (getWWriters() > 0) synchronized (WQueue) { WriteQueue.notify(); before: if (ip %10 == 0) { … } after: authenticated --; 5/24/2019 ABB Workshop

Concerns and their Separation (cont) pointcut: call(Book.write(…)); public int write (String msg, int ip) { 3 before: if ((getAReaders() == 0) && (getAWriters() == 0)) { if(getWWriters() > 0 ) decrWWriters(); incrAWriters(); else if (getWReaders() > 0) synchronized (ReadQueue){ ReadQueue.notify(); } after: decrAWriters(); else synchronized (WQueue) { WQueue.wait(); before: if (getWWriters() == 0) { return true; } after: if (getWWriters() > 0) synchronized (WQueue) { WriteQueue.notify(); before: if (ip %10 == 0) { … } after: authenticated --; 5/24/2019 ABB Workshop

Terminology Aspect JoinPoint Model Encapsulation of an aspect as a software entity Includes code “Advice” to be executed at specific “PointCuts” Types of advice Before After Around JoinPoint Model A means to specify PointCuts PointCuts are sets JoinPoints JoinPoint: a point within the execution of your base system Specification of PointCuts can be based on Dynamic program information [ known at runtime] Static program information [known at compile time] 5/24/2019 ABB Workshop

Aspect – Aspect Interaction Dependence of Aspectual behavior Orthogonal No dependence between aspects (Logging and Scheduling) Non-Orthogonal Dependence between aspects (Synchronization and Scheduling) Orthogonal aspects “play” nice Non-orthogonal aspects hinder a protocol between them Reuse requires all related dependent aspects Alterations in aspects should maintain the dependence protocol Alteration of the protocol may require code alterations throughout all affected aspects 5/24/2019 ABB Workshop

Benefits Better abstractions to capture crosscutting concerns Separate development Easier means for program extensibility and evolution Higher potential for reuse Better software quality Easier to reason about program behavior Closer to Program Design PointCuts can be viewed as a generalization of Aspect/Object interactions Separation between Functional decomposition (OOP) Cross-cutting Concerns ( Aspects) Evolution towards “Plug-and-Play” Software Components and Components of the Shelf (COTS) Non-invasive program reconfiguration, adaptation, evolution 5/24/2019 ABB Workshop