Wicca v2 demo Dynamic weaving using the.NET 2.0 Debugging APIs Marc Eaddy Columbia University.

Slides:



Advertisements
Similar presentations
Mohamed ElBendary and John Boyland University of Wisconsin-Milwaukee.
Advertisements

Towards a Standard Interface for Runtime Inspection in AOP Environments OOPSLA Workshop on Tool for AOSD, Seattle, November 2002 Katharina Mehner and Awais.
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
1 JAC : Aspect Oriented Programming in Java An article review by Yuval Nir and Limor Lahiani.
University of British Columbia Software Practices Lab Fluid AOP Join Point Models Terry Hon Gregor Kiczales.
University of British Columbia Software Practices Lab 2005 CASCON A Fluid AOP Editor Terry Hon Gregor Kiczales.
Aspect-Oriented Programming using Phoenix Marc Eaddy MSR Intern Columbia University.
C# Structs, operator overloading & attributes. Structs ~ Structures Structs are similar to classes: they represent data structures with data and functions.
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.
Motivation □ Maintenance dominates software costs 2.
Rigorous Fault Tolerance Using Aspects and Formal Methods Shmuel Katz Computer Science Department The Technion Haifa, Israel
More on AspectJ. aspect MoveTracking { private static boolean _flag = false; public static boolean testAndClear() { boolean result = _flag; _flag = false;
A Formal Model of Modularity in Aspect-Oriented Programming Jonathan Aldrich : Objects and Aspects Carnegie Mellon University.
AOP and Aspect C++ presentation by Igor Kotenkov based on presentation by Andreas Gal, Daniel Lohmann and Olaf Spinczyk.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
Programming Languages and Paradigms Object-Oriented Programming.
Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.
Taming Obliviousness in Aspects with Data-flow Analysis and Design by Contract Tim Molderez and Dirk Janssens Ansymo Antwerp Systems and Software Modelling.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
Spring core v3.x Prepared by: Nhan Le. History v3.0 Spring Expression Language Java based bean metadata v3.1 Cache Abstraction Bean Definition Profile.
Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
What is “model transformation”? Distinction between source and target Source may be same as target May be multiple sources, or targets Reaching a fixed.
Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, System and Software Engineering.
MOTOROLA and the Stylized M Logo are registered in the US Patent & Trademark Office. All other product or service names are the property of their respective.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
Aspect Oriented Programming Gülşah KARADUMAN.
Ptolemy.cs.iastate.edu Balances expressiveness and modular reasoning for aspect-oriented software development. Developer I really need to separate my crosscutting.
Methodology: The AOP Refactoring Process Aspect-Oriented Refactoring of the Apache Cocoon Shared-Object Resource Allocation System Jeff Dalton Advisor:
A Distributed Aspect-Oriented System for J2EE Applications Muga Nishizawa and Shigeru Chiba (Tokyo Institute of Technology, Japan) Background - As benefits.
Design Rules for Increasing Modularity with CaesarJ Carlos Eduardo Pontual Advisor: Paulo Borba 17/06/2010.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
© Siemens AG, CT SE 2, Iris Groher, Markus Voelter C O R P O R A T E T E C H N O L O G Y XWeave – Models and Aspects in Concert 1 XWeave Models.
CCC: An Aspect-Oriented Intermediate Language on.Net Platform Yingfei Xiong and Feng Wan University of Electronic Science and Technology of China, China.
An Overview of Aspects Shmuel Katz Computer Science Department The Technion
Aspect-Oriented Programming An Introductory Presentation Mike Landi MSCS Candidate Union University.
OO as a language for acm l OO phrase l Mental model of key concepts.
Aspect-Oriented Programming and Modular Reasoning G. KiczalesM. Mezini Presented by Alex Berendeyev.
IDENTIFYING SEMANTIC DIFFERENCES IN ASPECTJ PROGRAMS Martin Görg and Jianjun Zhao Computer Science Department, Shanghai Jiao Tong University.
Introducing Allors Applications, Tools & Platform.
Weaving a Debugging Aspect into Domain-Specific Language Grammars SAC ’05 PSC Track Santa Fe, New Mexico USA March 17, 2005 Hui Wu, Jeff Gray, Marjan Mernik,
Applying Translucid Contracts for Modular Reasoning about Aspect and Object Oriented Events Mehdi Bagherzadeh Gary T. Leavens Robert Dyer Foundations of.
Alloy-based Lightweight Verification for Aspect-oriented Architecture Naoyasu Ubayashi(Kyushu Institute of Technology) Yuki Sato(Kyushu Institute of Technology)
Neal Stublen Tonight’s Agenda  Indexers  Delegates and events  Operator overloading  Class inheritance  Q&A.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
Introduction to Object-Oriented Programming Lesson 2.
Programmeren 1 6 september 2010 HOORCOLLEGE 2: INTERACTIE EN CONDITIES PROGRAMMEREN 1 6 SEPTEMBER 2009 Software Systems - Programming - Week.
04 |Sharing Code Between Windows 8 and Windows Phone 8 in Visual Studio Ben Riga
aspectj tools new and noteworthy Mik Kersten University of British Columbia Adrian Colyer IBM Hursley OOPSLA, October
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
AOSD'04, Lancaster, UK 1 Remote Pointcut - A Language Construct for Distributed AOP Muga Nishizawa (Tokyo Tech) Shigeru Chiba (Tokyo Tech) Michiaki Tatsubori.
Access Specifier. Anything declared public can be accessed from anywhere. Anything declared private cannot be seen outside of its class. When a member.
Thesis Proposal Defense 12/13/06 Marc Eaddy. 12/13/2006Thesis Proposal2 Motivation Modularity is unnecessarily limited by the presence of crosscutting.
AspectScope: An Outline Viewer for AspectJ Programs Michihiro Horie, Shigeru Chiba Tokyo Institute of Technology, Japan.
University of British Columbia Software Practices Lab Uniform Support for Modeling Crosscutting Structure Maria Tkatchenko Gregor Kiczales Work supported.
AOP with AspectJ Awais Rashid, Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
AspectJ Development Tools Mik Kersten University of British Columbia October 28, 2003.
L’origine dei mali: le dipendenze tra componenti Stefano Leli 14° Workshop DotNetMarche Venerdì 16 aprile
Modern Programming Tools And Techniques-I
An Interface Mechanism for Encapsulating Weaving in Class-based AOP
/* LIFE RUNS ON CODE*/ Konstantinos Pantos Microsoft MVP ASP.NET
Inheritance and Polymorphism
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Java Programming Language
Interfaces.
Structuring Adaptive Applications using AspectJ and AOM
CIS 199 Final Review.
AspectAda Aspect-Oriented Programming for Ada95
Presentation transcript:

Wicca v2 demo Dynamic weaving using the.NET 2.0 Debugging APIs Marc Eaddy Columbia University

Marc Eaddy – Columbia University Wicca: A research platform Advanced separation of concerns (ASOC) ◦ First dynamic weaver based on.NET 2.0 Debugging APIs ◦ New breakpoint weaving technique ◦ New metrics for measuring crosscutting Novel language mechanisms ◦ Statement annotations ◦ Side classes Dynamic software updating 2 AOSD 2007 Experimenting with techniques for modularizing crosscutting concerns

Marc Eaddy – Columbia University Wicca: A research platform 3 AOSD 2007 Experimenting with techniques for modularizing crosscutting concerns

Marc Eaddy – Columbia University Wicca supports multiple weaving strategies 4 AOSD 2007

Marc Eaddy – Columbia University Wicca transformation pipeline 5 AOSD 2007 Compiler Post-Link Weaver Post-Link Weaver Deltas Aspect Assemblies Aspect Assemblies Compiled Program Compiled Program Source Files Source Files Woven Program Break Points Break Points

Marc Eaddy – Columbia University Phx.Morph 6 AOSD 2007

Marc Eaddy – Columbia University Demo setup: Simple Draw SimpleDraw draws Shapes on a Display Naïve implementation couples Shape and Display concerns public init() { s = new Shape[3]; s[0] = new Point(10, 10); s[1] = new Point(5, 5); s[2] = new Line(new Point(1, 9), new Point(9, 1)); for (int i = 0; i < s.Length; i++) Display.instance().addShape(s[i]); Display.instance().update(); SimpleDraw.cs public void moveBy(int dx, int dy) { x += dx; y += dy; Display.instance().update(); public void moveBy(int dx, int dy) { a.moveBy(dx, dy); b.moveBy(dx, dy); Display.instance().update(); Point.cs Line.cs 7 AOSD 2007

Marc Eaddy – Columbia University Demo setup: Simple Draw SimpleDraw draws Shapes on a Display Naïve implementation couples Shape and Display concerns public init() { s = new Shape[3]; s[0] = new Point(10, 10); s[1] = new Point(5, 5); s[2] = new Line(new Point(1, 9), new Point(9, 1)); for (int i = 0; i < s.Length; i++) Display.instance().addShape(s[i]); Display.instance().update(); SimpleDraw.cs public void moveBy(int dx, int dy) { x += dx; y += dy; Display.instance().update(); public void moveBy(int dx, int dy) { a.moveBy(dx, dy); b.moveBy(dx, dy); Display.instance().update(); Point.cs Line.cs 8 AOSD 2007

Marc Eaddy – Columbia University Demo 1: Static byte code weaving AOSD C# Compiler C# Compiler Phx.Morph Deltas Aspect Assemblies Aspect Assemblies Compiled Program Compiled Program C# Files C# Files Woven Program Break Points

Marc Eaddy – Columbia University Dynamic weaving.NET 2.0 Debugging APIs ◦ Edit-and-Continue API  Replaces the.NET 1.1 Profiler API  Dynamic AOP  Edit-and-Continue  Patching ◦ Breakpoint API – Noninvasive advising ◦ FuncEval API – In-process advice execution ◦ Intended for debugging, not dynamic AOP Microsoft Managed Debugger ◦ Hosts Wicca plug-in ◦ Hosts client program in separate process ◦ Command-line shell for weaving commands 10 AOSD 2007

Marc Eaddy – Columbia University Demo 2: Dynamic byte code weaving Using.NET 2.0 Edit-and-Continue API 11 AOSD 2007 C# Compiler C# Compiler Phx.Morph Aspect Assemblies Aspect Assemblies Compiled Program Compiled Program C# Files C# Files Deltas Woven Program Break Points

Marc Eaddy – Columbia University Demo 3: Dynamic bp weaving Noninvasive advising via Breakpoint API In-process advice execution via FuncEval API 12 AOSD 2007 Phx.Morph Aspect Assemblies Aspect Assemblies Compiled Program Compiled Program C# Files C# Files Break Points Break Points Woven Program Deltas C# Compiler C# Compiler

Marc Eaddy – Columbia University Wicca’s frontend ◦ Wicca# compiler Extends C# to support ◦ Statement annotations ◦ Side classes Goal ◦ Actually “modularize” crosscutting concerns (without sacrificing other modularity properties) Wicca# language 13 AOSD 2007

Marc Eaddy – Columbia University Statement annotations Fine-grained advising ◦ Statement-level advising (more elegant than dummy methods) ◦ Declarative instance-level advising Other possibilities ◦ Optimization and parallelization hints ◦ Contracts ◦ Avoiding reweaving ◦ Fault isolation ◦ Oblivious debugging “Statement Annotations for Fine-Grained Advising”, RAM-SE 2006 Allows any program statement to be annotated //[Concern("Input")] inputMapper.Update(elapsedTime); 14 AOSD 2007

Marc Eaddy – Columbia University Quantifying crosscutting “Identifying, Assigning, and Quantifying Crosscutting Concerns”, ACOM 2007 Display updating in SimpleDraw ◦ Degree of scattering: ◦ Scattering visualization (ala SeeSoft): 15 AOSD 2007

Marc Eaddy – Columbia University Demo 4: Concern profiling Statement annotation-based advising 16 AOSD 2007 Wicca# Compiler Wicca# Compiler Compiled Program Compiled Program Wicca# Source Files Wicca# Source Files Phx.Morph Aspect Assemblies Aspect Assemblies Woven Program Deltas Break Points

Marc Eaddy – Columbia University Side classes Powerful and disciplined class extension Powerful Combines subclasses, aspects, open classes, and refinements Unified subclass-like notation and semantics (similar to Eos) Virtual fields, constructors, and static members Multiple base classes can be extended simultaneously Extension order is arbitrary or explicit Disciplined Extensions must be explicitly allowed Honors access restrictions (public, private, virtual, …) Limits quantification 17 AOSD 2007

Marc Eaddy – Columbia University Expression problem revisited Need to parse simple expression language e.g., Expressions: Literal, Add Operations: eval Extensibility goals Easily add new expressions Easily add new operations Cannot do both easily 18 AOSD 2007 P. Tarr, H. Ossher, W. Harrison, and S. Sutton Jr., "N Degrees of Separation: Multi-Dimensional Separation of Concerns," ICSE 1999 M. Torgersen, "The Expression Problem Revisited," ECOOP 2004

Marc Eaddy – Columbia University abstract class Expression { abstract int eval(); } class Add : Expression { public Expression left, right; public Add(Expression left, Expression right) { this.left = left; this.right = right; } public int eval() { return left.eval() + right.eval(); } } Parser implementation in OO 19 AOSD 2007 Concern: Add printing Operations are crosscutting!

Marc Eaddy – Columbia University abstract class PrintingExpr : Expression { abstract void print(); } class PrintingAdd : Add { public void print() { Console.WriteLine(left + “+” + right); } Add printing using subclassing 20 AOSD 2007 Invasive Inflexible

Marc Eaddy – Columbia University abstract class PrintingExpr + Expression { abstract void print(); } class PrintingAdd + Add { public void print() { Console.WriteLine(left + “+” + right); } Printing the side class way 21 AOSD 2007 Modularizes the printing concern Side class implicitly extends base class Clients (or other sub/side classess) oblivious

Marc Eaddy – Columbia University Caching Concern: Cache expression evaluation Invalidate cache when expression changes AOSD

Marc Eaddy – Columbia University interface IObserver { void onChange(); } class CachableExpr + Expression : IObserver { protected IObserver observer = null; protected int cache; protected bool isCacheValid = false; void onChanged() { isCacheValid = false; if (observer != null) observer.onChanged(); } Side class: Caching eval 23 AOSD 2007

Marc Eaddy – Columbia University interface IObserver { void onChange(); } class CachableExpr + Expression : IObserver { protected IObserver observer = null; protected int cache; protected bool isCacheValid = false; void onChanged() { isCacheValid = false; if (observer != null) observer.onChanged(); } Side class: Caching eval 24 AOSD 2007

Marc Eaddy – Columbia University class CachableAdd + Add { public Add(Expression left, Expression right) { base(left, right); this.left.observer = this; this.right.observer = this; } override public int eval() { if (!isCacheValid) { cache = base.eval(); isCacheValid = true; } return cache; } Side class: Caching eval (2) 25 AOSD 2007

Marc Eaddy – Columbia University class CachableAdd + Add { public Add(Expression left, Expression right) { base(left, right); this.left.observer = this; this.right.observer = this; } override public int eval() { if (!isCacheValid) { cache = base.eval(); isCacheValid = true; } return cache; } Side class: Caching eval (2) 26 AOSD 2007

Marc Eaddy – Columbia University Side class: Caching eval (3) override Expression left { set { base.left = value; this.left.observer = this; this.onChange(); } override Expression right { set { base.right = value; this.right.observer = this; this.onChange(); } 27 AOSD 2007

Marc Eaddy – Columbia University Side class: Caching eval (3) override Expression left { set { base.left = value; this.left.observer = this; this.onChange(); } override Expression right { set { base.right = value; this.right.observer = this; this.onChange(); } 28 AOSD 2007

Marc Eaddy – Columbia University Side class: Caching eval (4) override Expression [$which = left | right] { set { base.$which = value; this.$which.observer = this; this.onChange(); } 29 AOSD 2007

Marc Eaddy – Columbia University class Add : Expression { public virtual Expression left, right; public Add(Expression left, Expression right) { this.left = left; this.right = right; } public virtual int eval() {return left.eval() + right.eval();} } Base class must allow extension 30 AOSD 2007

Marc Eaddy – Columbia University Addresses needs of existing mechanisms Subclasses ◦ Inflexible composition ◦ Only extend one base class ◦ Only extend instance methods ◦ Requires invasive changes in clients Open classes/refinements/mixins ◦ Need for composition ordering ◦ Need for constructor and static member overriding Aspects ◦ Lack of modular reasoning ◦ Poor integration with existing OO semantics and notation ◦ Need for symmetric model ◦ Matching wrong join points AOSD

Marc Eaddy – Columbia University Conclusions Wicca is for experimenting with ASOC Side classes unifies aspects and subclasses to better modularize concerns 32 AOSD 2007

Marc Eaddy – Columbia University Acknowledgements Microsoft Phoenix Team Wicca developers ◦ Boriana Ditcheva ◦ Rajesh Ramakrishnan ◦ Adam Vartanian 33 AOSD 2007

Marc Eaddy – Columbia University Thank you! 34 AOSD 2007

Marc Eaddy – Columbia University Phx.Morph architecture Phx.Morph Editors Open Classes, binary and breakpoint weaving Phoenix-specific AOP Attribute Handlers Phoenix PEREW Assembly Re-Writer Phx.Aop AOP Joinpoints, pointcuts, … Attributes Custom AOP annotations.NET Morph Plugin 35 AOSD 2007

Copyright © Marc Eaddy Wicca architecture 36AOSD 2007

Copyright © Marc Eaddy Phx.Morph Wicca # Compiler Wicca# Compiler Wicca architecture 37AOSD 2007

Marc Eaddy – Columbia University38 AOSD 2007 Legalizing statement annotations

Marc Eaddy – Columbia University Legalizing statement annotations 39 AOSD 2007