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

Slides:



Advertisements
Similar presentations
Modular Verification of Higher-Order Methods in JML Gary T. Leavens, Steve Shaner, and David A. Naumann Support from US NSF grant CCF
Advertisements

1 CS506 Seminar: Zehn Programmier-sprachen in einem Semester, Language Features, by L. Yamamoto Programming Languages Features Programming styles or paradigms.
Chapter 12 Separate Compilation and Namespaces. Abstract Data Type (ADT) ADT: A data type consisting of data and their behavior. The abstraction is that.
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.
© 2007 ATLAS Nantes 1 Atlas Model Weaver Use Case: Aspect Oriented Modeling Marcos Didonet Del Fabro Atlas Group (INRIA & LINA), Université de Nantes,
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development.
Aspect Oriented Programming - AspectJ Radhika Rajput.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Modularization.
Secure Systems Research Group - FAU Aspect Oriented Programming Carlos Oviedo Secure Systems Research Group.
Taking into account meta-programming concerns in static program verification Julien Charles.
An Untyped Calculus of Aspect- Oriented Programs Radha Jagadeesan Alan Jeffrey James Riely DEPAUL UNIVERSITY, CHICAGO.
Aspect-Oriented Programming: An Overview Brandon Wirick Feb
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.
AspectJ2EE/Clasa Israel Institute of Technology The Computer Science department Itay Maman.
Jason Hallstrom (Clemson), Joan Krone (Denison), Joseph E. Hollingsworth (IU Southeast), and Murali Sitaraman(Clemson) This workshop is funded in part.
A Formal Model of Modularity in Aspect-Oriented Programming Jonathan Aldrich : Objects and Aspects Carnegie Mellon University.
What is Object-Oriented Programming?. Objects – Variables and Logic inside "Objects", not standalone code – Objects contain related variables and functions.
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.
VERIFICATION OF ASPECT ORIENTED MODELS BY DON MARTIN JAYASHREE VENKIPURAM PATHANGI PIYUSH SRIVASTAVA REFERENCES F. Mostefaoui and J. Vachon,” Design level.
Abstract Factory Design Pattern making abstract things.
Composing Adaptive Software Authors Philip K. McKinley, Seyed Masoud Sadjadi, Eric P. Kasten, Betty H.C. Cheng Presented by Ana Rodriguez June 21, 2006.
Computer Science and Engineering College of Engineering The Ohio State University Interfaces The credit for these slides goes to Professor Paul Sivilotti.
©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.
University of Southern California Center for Systems and Software Engineering Model-Based Software Engineering Supannika Koolmanojwong Spring 2013.
Aspect Oriented Programming Gülşah KARADUMAN.
VERIFICATION OF ASPECT-ORIENTED MODELS Review of Aspect-Oriented Definitions aspect – crosscutting concern that may involve multiple classes pointcut –
JCMP: Linking Architecture with Component Building Guoqing Xu, Zongyuan Yang and Haitao Huang Software Engineering Lab, East China Normal University SACT-01,
A Distributed Aspect-Oriented System for J2EE Applications Muga Nishizawa and Shigeru Chiba (Tokyo Institute of Technology, Japan) Background - As benefits.
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.
Aspect-Oriented Programming and Modular Reasoning G. KiczalesM. Mezini Presented by Alex Berendeyev.
Neelam Soundarajan 1 Johan Dovland 2 Jason Hallstrom 3 Tracing Correct Usage of Design Patterns 2 Computer Sc. Dept. Clemson University 1 Computer Sc.
Adaptive Software Kevin Cella Graduate Seminar 02/04/2005.
Inter-Type Declarations in AspectJ Awais Rashid Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
Alloy-based Lightweight Verification for Aspect-oriented Architecture Naoyasu Ubayashi(Kyushu Institute of Technology) Yuki Sato(Kyushu Institute of Technology)
AOP-Driven Variability in Software Product Lines Vander Alves, Ayla Dantas, and Paulo Borba Informatics Center – UFPE – Brazil
Click to edit Master text styles JavaMOP Hamid Reza Niroomand A presentation to Dr. Babamir.
Kansas City Java User’s Group Jason W. Bedell July 12, 2006
Generating Aspect Code from Models OOPSLA 2002 Workshop on Generative Techniques in the Context of the MDA November 5 th, 2002 Seattle, WA This work is.
AOSD'04, Lancaster, UK 1 Remote Pointcut - A Language Construct for Distributed AOP Muga Nishizawa (Tokyo Tech) Shigeru Chiba (Tokyo Tech) Michiaki Tatsubori.
1 Here are some quotations to get an overview of the kinds of issues of interest.
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.
COMP319 REVISION © University of LiverpoolCOMP 319slide 1.
Responsibilities and Rewards: Reasoning about Design Patterns Neelam Soundarajan Computer Science & Engineering Ohio State University Joint work with Jason.
AOP with AspectJ Awais Rashid, Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
Aspect-Oriented Software Development (AOSD)
1 Aspectual Caml an Aspect-Oriented Functional Language Hideaki Tatsuzawa Hidehiko Masuhara Akinori Yonezawa University of Tokyo.
Design Refinement: From Patterns to System Implementation Neelam Soundarajan 1 Computer Science & Engineering Ohio State University ( 1 Joint work with.
Features of AOP languages AOP languages have the following main elements: –a join point model (JPM) wrt base PL –a specification language for expressing.
Software Engineering Lecture 7
Chengyu Sun California State University, Los Angeles
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Demeter Aspects Who We Are Aspectual Collaborations
Abstraction Functions and Representation Invariants
Chengyu Sun California State University, Los Angeles
A Brief Introduction to Aspect-Oriented Programming
Reliable Objects: Lightweight Testing for OO Languages
Aspect-oriented programming
An Extensible Contract Verifier for AspectJ
CS520 Web Programming Spring – Aspect Oriented Programming
AspectAda Aspect-Oriented Programming for Ada95
Aspect Oriented Software Design
Refactoring the Aspectizable Interfaces: An Empirical Assessment
Presentation transcript:

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

Design Patterns and Monitoring Patterns capture key system behaviors Patterns capture key system behaviors –Behaviors often cross-cutting –Usually, specified informally To monitor and test behaviors, informal specs are not enough To monitor and test behaviors, informal specs are not enough

Our Approach AOP aspect – Language construct, similar to a class, that implements cross-cutting behaviors for classes in an application AOP aspect – Language construct, similar to a class, that implements cross-cutting behaviors for classes in an application Aspects can be used to capture design pattern contracts Aspects can be used to capture design pattern contracts These aspects can be used to monitor system behavior to see if these contracts are respected These aspects can be used to monitor system behavior to see if these contracts are respected

Methodology Overview Contract Aspect for P (abstract) The contract aspect contains the main checking logic for a pattern The contract aspect contains the main checking logic for a pattern

Methodology Overview System Code Purportedly uses pattern P Contract Aspect for P (abstract) The contract aspect contains the main checking logic for a pattern The contract aspect contains the main checking logic for a pattern

Methodology Overview System Code Purportedly uses pattern P Contract Aspect for P (abstract) Subcontract Aspect Specific to System The subcontract aspect contains definitions specific to the application The subcontract aspect contains definitions specific to the application

Methodology Overview System Code Purportedly uses pattern P Contract Aspect for P (abstract) Subcontract Aspect Specific to System Compiled System Monitors P Compile/Weave

Methodology Overview Another System Also uses P Contract Aspect for P (abstract) Subcontract Aspect Specific to System

Methodology Overview Another System Also uses P Contract Aspect for P (abstract) Another Subct. Aspect Specific to System

Methodology Overview Another System Also uses P Contract Aspect for P (abstract) Another Subct. Aspect Specific to System Compiled System Also monitors P Compile/Weave

Benefits of Our Approach No instrumentation of source code No instrumentation of source code Monitoring code separate from application code Monitoring code separate from application code Contract aspect needs to be created only once for a given design pattern Contract aspect needs to be created only once for a given design pattern –Only need to create new subcontract aspects for each system to be monitored

Aspect Terminology Pointcut – A set of places in the class code where an aspect can insert new behavior Pointcut – A set of places in the class code where an aspect can insert new behavior Advice – Code associated with a pointcut that implements this new behavior Advice – Code associated with a pointcut that implements this new behavior

Monitoring with Aspects before(Calc c): SqPc(c) { } after(Calc c): SqPc(c) { } aspect CalcMonitor { int st_old; pointcut SqPc(Calc c): exec(Sqrt()) && targ(c); assert(c.st >= 0); st_old = c.st; assert(c.st^2 <= st_old && st_old <(c.st+1)^2); } class Calc { int st; void Sqrt() { int i = 1; while(i*i<=st) i++; st = i-1; }

Pattern Example: Observer Subject +Attach(in Observer) +Notify() +Detach(in Observer) ConcreteSubject - subjectState Observer + Update() ConcreteObserver + Update() - observerState observers subject 1 * for all o in observers o.Update()

The Contract Aspect Formalizes the behavior intended by the pattern Formalizes the behavior intended by the pattern Advice provides the main monitoring code for the pattern Advice provides the main monitoring code for the pattern However, method names/signatures and concrete definitions for relations vary from application to application However, method names/signatures and concrete definitions for relations vary from application to application Use abstract pointcuts and methods for these in the contract aspect Use abstract pointcuts and methods for these in the contract aspect

Part of the Contract Aspect for Observer Property: After call to Update(), the Observer should be consistent with its subject Property: After call to Update(), the Observer should be consistent with its subject after(Subj s, Obs o): UpdatePc(s, o) { assert(Consistent(s, o)); } abstract pointcut UpdatePc(Subj s, Obs o) ; abstract boolean Consistent(Subj s, Obs o) ;

Part of the Contract Aspect for Observer Another property: If a call to a Subject method results in a change in state, Notify() should have been called Another property: If a call to a Subject method results in a change in state, Notify() should have been called after(Subj s): SubjMethPc(s) { assert(! Modified(s_old, s)); } before(Subj s): NotifyPc(s) { s_old = copyObject(s); … } abstract pointcut SubjMethPc(Subj s) ; abstract pointcut NotifyPc(Subj s) ; abstract boolean Modified(Subj s1, Subj s2) ;

In the Subcontract Aspect… Associate concrete classes with pattern roles Associate concrete classes with pattern roles –Insert dummy interfaces in the class hierarchy (AspectJ feature) Pointcut definitions that associate role methods with actual methods in the application Pointcut definitions that associate role methods with actual methods in the application Definitions for relations specific to the given application Definitions for relations specific to the given application

Hospital Example Patients play the Subject role Patients play the Subject role –State includes temp and heart rate Nurses observe Patients Nurses observe Patients –Keep track if Patients have a fever or not –Updates done with –Updates done with Nrs.TempUpd(Pat) Doctors also observe Patients Doctors also observe Patients –Record whether or not patients are in stable condition –Updates done with –Updates done with Doc.CondUpd(Pat)

Pointcuts in the Subcontract Aspect In the subcontract aspect, we give definitions for the abstract pointcuts mentioned in the contract aspect In the subcontract aspect, we give definitions for the abstract pointcuts mentioned in the contract aspect Examples: Examples: pointcut UpdatePc(Subj subj, Obs obs) : ( exec(Nrs.TempUpd(Pat)) || exec(Doc.CondUpd(Pat)) ) && targ(obs) && arg(subj) ; pointcut SubjMethPc(Subj subj) : exec(Pat.*(..)) && targ(subj) ;

Defining Relations Need to provide definitions of application-specific relations in the subcontract aspect Need to provide definitions of application-specific relations in the subcontract aspect Example: Modified Example: Modified boolean Modified(Subj s1, Subj s2) { return s1.temp != s2.temp || s1.hrtRate != s2.hrtRate; }

Defining Relations Another example: Consistent Another example: Consistent boolean Consistent(Subj subj, Obs obs) { if (obs instanceOf Nrs) { return subj.temp > 104 == obs.isFeverish(subj); } else if (obs instanceOf Doc) { return (55 < subj.hrtRate < 100 && 92 < subj.temp < 105) == obs.isStable(subj); } else { /* Error! */} }

Discussion Contract aspects generally harder to write than the subcontract aspects Contract aspects generally harder to write than the subcontract aspects –Only have to write them once! Information such as method call sequences can be tracked using auxiliary variables in the aspect Information such as method call sequences can be tracked using auxiliary variables in the aspect Pointcuts can encompass more than just method calls Pointcuts can encompass more than just method calls Current and future work Current and future work – MonGen and PCL

Presented Methodology System Code Purportedly uses pattern P Contract Aspect for P (abstract) Subcontract Aspect Specific to System Compiled System Monitors P Compile/Weave Monitoring Code

MonGen Methodology Contract Spec for P Subcontract Spec Specific to System Specs written in PCL MonGen System Code Purportedly uses pattern P Monitoring Aspect for System Compiled System Monitors P Compile/Weave

Conclusion Design patterns often describe behaviors that encompass multiple classes Design patterns often describe behaviors that encompass multiple classes Aspects are a natural way to monitor such behaviors Aspects are a natural way to monitor such behaviors Separating the essence of the pattern from the details of the application saves time and effort Separating the essence of the pattern from the details of the application saves time and effort

Questions? MonGen Web page: MonGen Web page: –