How To Write A Program In Ptolemy



Similar documents
Aspect-Oriented Programming

Coordinated Visualization of Aspect-Oriented Programs

Fabiano Cutigi Ferrari (CV)

Combining Static and Dynamic Impact Analysis for Large-scale Enterprise Systems

Aspect Oriented Programming. with. Spring

Remote Pointcut - A Language Construct for Distributed AOP

OASIS: Organic Aspects for System Infrastructure Software Easing Evolution and Adaptation through Natural Decomposition

A Joint Point Interfaces for Safe and Flexible Decoupling of Aspects

Specifying and Dynamically Monitoring the Exception Handling Policy

Progress Report Aspect Oriented Programming meets Design Patterns. Academic Programme MSc in Advanced Computer Science. Guillermo Antonio Toro Bayona

OOAspectZ and aspect-oriented UML class diagrams for Aspect-oriented software modelling (AOSM)

APPLE: Advanced Procedural Programming Language Elements

Generating Aspect Code from UML Models

The Application Monitor Aspect Pattern

Aspect-Oriented Composition of Design Patterns: A Quantitative Assessment

Integration of Application Business Logic and Business Rules with DSL and AOP

Integration of Application Business Logic and Business Rules with DSL and AOP

Chapter 5 Aspect Oriented Programming

Why Do Developers Neglect Exception Handling?

Component-Based Software Development with Aspect-Oriented Programming

Harmless Advice. Daniel S Dantas Princeton University. with David Walker

Program Comprehension of Feature-Oriented Software Development

Modularizing Communication Middleware Concerns Using Aspects

Learn Java - The Application Monitor Aspect Pattern

Aspects for Testing Aspects?

On the Evaluation of an Open Software Engineering Course

AOSD - Enhancing SoC :: INF5120 :: Mansur Ali Abbasi. AOSD :: Aspect Oriented Software Development SoC :: Separation of Concerns

Change Impact Analysis for AspectJ Programs

AIPLE-IS: An Approach to Develop Product Lines for Information Systems Using Aspects

Analyzing Software Updates: Should You Build a Dynamic Updating Infrastructure?

Evolution of Web Applications with Aspect-Oriented Design Patterns

Enterprise AOP with Spring Applications IN ACTION SAMPLE CHAPTER. Ramnivas Laddad FOREWORD BY ROD JOHNSON MANNING

Aspect-Oriented Multi-Client Chat Application

Service Oriented Architectures

Identifying Code Smells with Multiple Concern Views

DEPENDENCE FLOW GRAPH FOR ANALYSIS OF ASPECT- ORIENTED PROGRAMS

Software Engineering Process. Kevin Cathey


Using an Aspect Oriented Layer in SOA for Enterprise Application Integration

Designing with Exceptions. CSE219, Computer Science III Stony Brook University

Computing Concepts with Java Essentials

Refactoring and AOP under Scrutiny

Automated Data Collection for Usability Evaluation in Early Stages of Application Development

Percerons: A web-service suite that enhance software development process

Perspectives on Automated Testing of Aspect-Oriented Programs

Distributed Systems Development: Can we Enhance Evolution by using AspectJ?

XPoints: Extension Interfaces for Multilayered Applications

Aspect Refactoring Verifier

Dart a modern web language

A Classification Framework for Pointcut Languages in Runtime Monitoring

A Review of Aspect Maps, Java

Representing Change by Aspect

Aspectual Mixin Layers

The Concern-Oriented Software Architecture Analysis Method

Android Security. Giovanni Russello

A COMPARISON OF AOP BASED MONITORING TOOLS

Composing Concerns with a Framework Approach

Aspect-Oriented Software Development

Code Contracts User Manual

Topics in Software Reliability

Rigorous Software Development CSCI-GA

The Service Revolution software engineering without programming languages

CS 451 Software Engineering Winter 2009

TOOLS FOR TEAM DEVELOPMENT: WHY VENDORS ARE FINALLY GETTING IT RIGHT

CSC 408F/CSC2105F Lecture Notes

Aspect-oriented Refactoring of a J2EE Framework for Security and Validation Concerns

Automated Test Generation for AspectJ Programs

An Aspect-Oriented Programming Language for Agile Software Development

On Type Restriction of Around Advice and Aspect Interference

An Aspect-Oriented Product Line Framework to Support the Development of Software Product Lines of Web Applications

Encapsulating Crosscutting Concerns in System Software

Remote Method Invocation

Monitoring Goals With Aspects

Extending an Open-Source BPEL Engine with Aspect-Oriented Programming

Aspect-Oriented Web Development in PHP

Table of Contents. Background and Goal Crafting a Plan for SDN Define SDN Identify the Primary Opportunities...

An Android-based Instant Message Application

Product Overview and Examples

Object Oriented Design

Compose*: Language-Independent Aspects for.net

The Sun Certified Associate for the Java Platform, Standard Edition, Exam Version 1.0

Evaluating the Use of AOP and MDA in Web Service Development

Run-Time Assertion Checking with Énfasis Verificación de Aseveraciones a Tiempo de Ejecución con Énfasis

CONTRASTING ASPECTUAL DECOMPOSITIONS WITH OBJECT- ORIENTED DESIGNS IN CONTEXT-AWARE MOBILE APPLICATIONS

2/9/2010. Standard Approach to Distribution. Remote Procedure Calls (RPC) Example: Music Jukebox in the Cloud

Keywords Aspect-Oriented Modeling, Rule-based graph transformations, Aspect, pointcuts, crosscutting concerns.

Chap 4. Using Metrics To Manage Software Risks

Concern Impact Analysis in Configurable System Software The AUTOSAR OS Case

Software Metrics. Lord Kelvin, a physicist. George Miller, a psychologist

Aspect-Oriented Change Realization Based on Multi-Paradigm Design with Feature Modeling

Unification of AOP and FOP in Model Driven Development

Technion - Computer Science Department - Ph.D. Thesis PHD Using Aspects to Support the Software Process.

Fundamentals of Java Programming

An Exception Monitoring System for Java

Java with Eclipse: Setup & Getting Started

Service-Oriented Architectures

Using Object Teams for State-Based Class Testing

A common framework for aspect mining based on crosscutting concern sorts

Adaptable Access Control for Electronic Medical Records

e ag u g an L g ter lvin v E ram Neal G g ro va P Ja

Transcription:

A Preliminary Study of Quantified, Typed Events Robert Dyer 1, Mehdi Bagherzadeh 1, Hridesh Rajan 1 and Yuanfang Cai 2 1 Iowa State University 2 Drexel University {rdyer,mbagherz,hridesh}@cs.iastate.edu yfcai@cs.drexel.edu March 16, 2010

Ptolemy: What, Why? Background An Example in AspectJ An Example in Ptolemy Ptolemy 1 adds quantified, typed events to OO languages 1 Well-defined interfaces between base & crosscutting code 2 Separate type-checking, modular reasoning Combines aspect-oriented (AO) and implicit invocation (II) Solves problems with AO and II: AO: quantification failure, fragile pointcuts, limited context information II: coupling of observers, no replacement of event code, no quantification 1 Rajan and Leavens - ECOOP 08 Dyer, Bagherzadeh, Rajan and Cai 2 Preliminary Study of Quantified, Typed Events

Background An Example in AspectJ An Example in Ptolemy This Paper: Why, How, and What? Motivation: Why use Quantified, Typed Events 2? Approach: MobileMedia case study 3 : Change impact and Design value analysis Software engineering metrics: makes implicit coupling in AO explicit and decreases change impact NOV analysis: Ptolemy needs ITDs (so we added it) 2 Rajan and Leavens - ECOOP 08 3 Figueiredo et al - ICSE 08 Dyer, Bagherzadeh, Rajan and Cai 3 Preliminary Study of Quantified, Typed Events

Running Example : Figure Editor Background An Example in AspectJ An Example in Ptolemy Elements of drawing Points, Lines, etc All such elements are of type FElement Challenge: Modularize display update policy Whenever an element of drawing changes Update the display Dyer, Bagherzadeh, Rajan and Cai 4 Preliminary Study of Quantified, Typed Events

Point and its two Events Background An Example in AspectJ An Example in Ptolemy class Point implements FElement { int x; int y; void setx(int x) { this.x = x; }.. void makeequal(point other) { if(!other.equals(this)) { other.x = this.x; other.y = this.y; }}} Changing FElement is different for two cases. Actual abstract event inside makeequal is the true branch. Dyer, Bagherzadeh, Rajan and Cai 5 Preliminary Study of Quantified, Typed Events

Background An Example in AspectJ An Example in Ptolemy Aspect Modularizing Display Updating aspect Update { around(felement fe) : execution(point.set*(..)) && this(fe) (execution(point.make*(..)) && args(fe) if(!fe.equals(this(fe)))) { proceed(fe); Display.update(); }} Enumeration required of two different joinpoints. Had to use if pointcut to get to the real event. Alternative is to refactor makeequal (refactoring doesn t always creates meaningful abstractions). Dyer, Bagherzadeh, Rajan and Cai 6 Preliminary Study of Quantified, Typed Events

Ptolemy: Declaring Event Types Background An Example in AspectJ An Example in Ptolemy void event FEChanged { FElement changedfe; } Event type is an abstraction (design this first). Declares context available at the concrete events. Interface, so allows design by contract (DBC) methodology. Dyer, Bagherzadeh, Rajan and Cai 7 Preliminary Study of Quantified, Typed Events

Ptolemy: Announcing Events Background An Example in AspectJ An Example in Ptolemy class Point implements FElement { int x; int y; void setx(int x) { announce FEChanged(this) { this.x = x; }} void makeequal(point other) { if(!other.equals(this)) { announce FEChanged(other) { other.x = this.x; other.y = this.y; }}}} Explicit, declarative, typed event announcement. Provides flexibility, e.g. see makeequal. Dyer, Bagherzadeh, Rajan and Cai 8 Preliminary Study of Quantified, Typed Events

Ptolemy: Binding to Events Background An Example in AspectJ An Example in Ptolemy class Update { when FEChanged do update; void update (FEChanged next) { invoke(next); //Like AspectJ proceed Display.update(); } public Update() { register(this); //Allows dynamic deployment }} Dyer, Bagherzadeh, Rajan and Cai 9 Preliminary Study of Quantified, Typed Events

Research Questions Motivation Background An Example in AspectJ An Example in Ptolemy How do these two designs compare? When do we see benefits of AO? When do we see benefits of Ptolemy? Dyer, Bagherzadeh, Rajan and Cai 10 Preliminary Study of Quantified, Typed Events

Benefits of Aspect-oriented Designs Benefits of Quantified, Typed Events Observed Benefits of Aspect-oriented Designs Static crosscutting features are very useful Inter-type declarations (ITDs) Declare Parents Softened Exceptions Dyer, Bagherzadeh, Rajan and Cai 11 Preliminary Study of Quantified, Typed Events

Inter-type declarations (ITDs) Benefits of Aspect-oriented Designs Benefits of Quantified, Typed Events Had to be emulated in Ptolemy 4 AspectJ: public T C.field; Ptolemy emulation strategy: static Hashtable fieldmap; public static T getfield(c); public static void setfield(c, T); 4 Ptolemy now supports AspectJ-style ITDs Dyer, Bagherzadeh, Rajan and Cai 12 Preliminary Study of Quantified, Typed Events

Declare Parents Motivation Benefits of Aspect-oriented Designs Benefits of Quantified, Typed Events Affects the type hierarchy Only used in revision 8 Effects modeled similar to ITDs Dyer, Bagherzadeh, Rajan and Cai 13 Preliminary Study of Quantified, Typed Events

Softened Exceptions Motivation Benefits of Aspect-oriented Designs Benefits of Quantified, Typed Events Aspects handle certain exceptions Softened exceptions don t need declared thrown in the base code Con: Ptolemy version still must declare those exceptions are thrown Pro: Ptolemy s exception handling code is (un)pluggable Dyer, Bagherzadeh, Rajan and Cai 14 Preliminary Study of Quantified, Typed Events

Softened Exceptions Motivation Benefits of Aspect-oriented Designs Benefits of Quantified, Typed Events AspectJ version: declare soft: RecordStoreEx : execution(public void ImageAccessor.addImageData(..)); public void addimagedata(..) throws InvalidImageDataEx, PersistenceMechanismEx { Without the aspect, the base code won t compile! Dyer, Bagherzadeh, Rajan and Cai 15 Preliminary Study of Quantified, Typed Events

Softened Exceptions Motivation Benefits of Aspect-oriented Designs Benefits of Quantified, Typed Events Ptolemy version: public void addimagedata(..) throws InvalidImageDataEx, PersistenceMechanismEx, RecordStoreEx { Even though RecordStoreEx isn t thrown by the body, it still must be declared! Dyer, Bagherzadeh, Rajan and Cai 16 Preliminary Study of Quantified, Typed Events

Benefits of Aspect-oriented Designs Benefits of Quantified, Typed Events Observed Benefits of Quantified, Typed Events No Quantification Failure No Fragile Pointcuts Can easily advise other advice (due to symmetry) Dyer, Bagherzadeh, Rajan and Cai 17 Preliminary Study of Quantified, Typed Events

Benefits of Aspect-oriented Designs Benefits of Quantified, Typed Events Solves Quantification Failure Problem In revision 2, the AspectJ version had to expose a while loop (by refactoring of course) Similar problems in other revisions Ptolemy versions did not need to refactor those points to expose to the aspects Dyer, Bagherzadeh, Rajan and Cai 18 Preliminary Study of Quantified, Typed Events

Benefits of Aspect-oriented Designs Benefits of Quantified, Typed Events Example of Quantification Failure in AO OO version:.. while (is.read(b)) {.. }.. AspectJ version:.. internalreadimage(..);.. private void internalreadimage(..) { while (is.read(b)) {.. } } Dyer, Bagherzadeh, Rajan and Cai 19 Preliminary Study of Quantified, Typed Events

No Quantification Failure Benefits of Aspect-oriented Designs Benefits of Quantified, Typed Events OO version:.. while (is.read(b)) {.. }.. Ptolemy version:.. announce ReadInternalImageAsByteArrayEvent() { while (is.read(b)) {.. } }.. Dyer, Bagherzadeh, Rajan and Cai 20 Preliminary Study of Quantified, Typed Events

No Fragile Pointcuts Motivation Benefits of Aspect-oriented Designs Benefits of Quantified, Typed Events Aspects implicitly match the base code Quantified, typed events make this coupling explicit Changes to the base code (e.g., renaming a method) can propogate to the aspects AspectJ: execution(* DeletePhoto(..)) Ptolemy: when DeletePhotoEvent do Handler What if DeletePhoto is renamed to RemovePhoto? Dyer, Bagherzadeh, Rajan and Cai 21 Preliminary Study of Quantified, Typed Events

Can easily advise other advice Benefits of Aspect-oriented Designs Benefits of Quantified, Typed Events AspectJ allows you to advise all advice, not specific advice bodies Exception handling modularity was not maintained in later revisions for AspectJ versions Ex: revision 8, aspect lancs.midp.mobilephoto.alternative.music.musicaspect Dyer, Bagherzadeh, Rajan and Cai 22 Preliminary Study of Quantified, Typed Events

Benefits of Aspect-oriented Designs Benefits of Quantified, Typed Events after() : addnewmediatoalbum() { try { /* advice body */ } catch (InvalidImageDataException e) {.. } } public void handler(addmediatoalbumevent next){ announce AddNewMediaToAlbumHandlerEvent() { /* advice body */ } } Dyer, Bagherzadeh, Rajan and Cai 23 Preliminary Study of Quantified, Typed Events

Software Engineering Metrics Net Options Value Analysis Overview of Change Impact AO vs. Ptolemy Ptolemy design limited change propagation Only had to change 13 event types in revision 7 AO revisions required changing 50 pointcuts in revision 7 No other Ptolemy revision required changing event types 28 pointcuts changed across 4 other AO revisions Dyer, Bagherzadeh, Rajan and Cai 24 Preliminary Study of Quantified, Typed Events

Software Engineering Metrics Net Options Value Analysis Net Options Value Analysis AO vs. Ptolemy 5 4 OO AO PTL 3 2 1 0 R1 R2 R3 R4 R5 R6 R7 R8 Dyer, Bagherzadeh, Rajan and Cai 25 Preliminary Study of Quantified, Typed Events

Software Engineering Metrics Net Options Value Analysis Net Options Value Analysis AO vs. Ptolemy 5 4 OO AO PTL 3 2 1 0 R1 R2 R3 R4 R5 R6 R7 R8 Ptolemy: higher NOV values for R2-R6 AO: higher value in R6 (Ptolemy doesn t have ITDs) Revisions adding ITDs: R3-R8 Dyer, Bagherzadeh, Rajan and Cai 26 Preliminary Study of Quantified, Typed Events

of Study and Future Work Explicit Coupling increases from OO AO Ptolemy Despite more coupling in Ptolemy, lower change impact Net options value increases from OO AO Ptolemy Future Work: Repeat the study with Ptolemy + ITDs Compare to other AO interface features Dyer, Bagherzadeh, Rajan and Cai 27 Preliminary Study of Quantified, Typed Events

Questions? http://www.cs.iastate.edu/ ptolemy/ http://ptolemyj.sourceforge.net Dyer, Bagherzadeh, Rajan and Cai 28 Preliminary Study of Quantified, Typed Events

Mobile Media Metrics Tables Citations Releases Table Release Description Type of Change R1 MobilePhoto core R2 Exception handling included Non-functional concern R3 Added photo sorting Optional feature Added editing photo labels Mandatory feature R4 Added favorites Optional feature R5 Allow users to keep multiple copies of photos Optional feature R6 Added send photo to other users by SMS Optional feature R7 Photo management made into two alternatives: photo or music One mandatory feature into two alternatives R8 Add video management Alternative feature Dyer, Bagherzadeh, Rajan and Cai 30 Preliminary Study of Quantified, Typed Events

Mobile Media Metrics Tables Citations Change Propagation Coupling and Cohesion Size Metrics Components PCs Event Types R2 R3 R4 R5 R6 R7 R8 OO 9 1 0 5 7 17 6 Added AO 12 2 3 6 8 21 16 PTL 13 4 2 6 8 23 18 OO 0 0 0 0 0 10 1 Removed AO 1 0 0 0 0 8 0 PTL 1 1 0 1 0 7 2 OO 5 8 5 8 6 12 22 Changed AO 5 10 2 8 5 16 9 PTL 11 8 1 9 5 16 8 Added AO 43 6 7 2 7 19 26 Removed AO 0 0 0 0 0 0 5 Changed AO 0 8 0 16 2 50 2 Added PTL 25 9 1 5 5 9 4 Removed PTL 0 1 0 1 0 3 0 Changed PTL 0 0 0 0 0 13 0 Dyer, Bagherzadeh, Rajan and Cai 31 Preliminary Study of Quantified, Typed Events

Mobile Media Metrics Tables Citations Change Propagation Coupling and Cohesion Size Metrics LCOO CBC Average Max Average Max R2 R3 R4 R5 R6 R7 R8 OO 6.38 10.08 10.88 8.83 10.24 12.04 11.80 AO 5.67 8.69 8.50 6.97 8.24 9.39 8.03 PTL 3.30 3.36 3.21 2.86 2.83 2.77 2.96 OO 64 70 71 73 96 113 114 AO 64 94 94 64 85 109 111 PTL 84 122 122 66 66 112 153 OO 1.46 2.00 2.36 3.17 3.30 3.54 3.96 AO 1.30 1.72 1.84 2.50 2.65 2.76 2.69 PTL 0.80 0.94 1.06 1.43 1.57 1.71 2.01 OO 9 13 13 11 11 15 20 AO 9 13 12 10 13 14 14 PTL 9 14 14 12 13 14 14 Dyer, Bagherzadeh, Rajan and Cai 32 Preliminary Study of Quantified, Typed Events

Mobile Media Metrics Tables Citations Change Propagation Coupling and Cohesion Size Metrics NOO NOA NOC LOC R2 R3 R4 R5 R6 R7 R8 OO 1159 1314 1363 1555 2051 2523 3016 AO 1276 1494 1613 1834 2364 3068 3806 PTL 1605 1923 2049 2374 2969 3655 4508 OO 24 25 25 30 37 46 51 AO 27 29 32 38 46 59 75 PTL 56 67 70 79 92 112 132 OO 62 71 74 75 106 132 165 AO 62 72 76 77 111 139 177 PTL 72 82 86 88 121 146 185 OO 124 140 143 160 200 239 271 AO 158 187 199 230 285 345 441 PTL 143 169 179 197 247 308 369 Dyer, Bagherzadeh, Rajan and Cai 33 Preliminary Study of Quantified, Typed Events

Mobile Media Metrics Tables Citations 1 Eduardo Figueiredo, Nelio Cacho, Claudio Sant Anna, Mario Monteiro, Uira Kulesza, Alessandro Garcia, Sergio Soares, Fabiano Ferrari, Safoora Khan, Fernando Castor Filho and Francisco Dantas. Evolving software product lines with aspects: an empirical study on design stability. In ICSE 08. 2 Hridesh Rajan and Gary T. Leavens. Ptolemy: a language with quantified, typed events. In ECOOP 08. 4 Kevin J. Sullivan, William G. Griswold, Yuanfang Cai, and Ben Hallen. The structure and value of modularity in software design. In ESEC/FSE 01. Dyer, Bagherzadeh, Rajan and Cai 34 Preliminary Study of Quantified, Typed Events