ADAPTIVE PROGRAMMING Sezen ERDEM December 2005.

Slides:



Advertisements
Similar presentations
Parametric Aspects. A way to design-pattern implementation (...and others)? Jordi Alvarez Open University of Catalonia Barcelona - Spain
Advertisements

February R. McFadyen1 Polymorphism Indirection Pure Fabrication Protected Variations (Law of Demeter) More GRASP Patterns.
Oct R McFadyen1 Recall UML Class Diagram BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..*
3/7/2003Bioinformatics1 How To Address Rapidly Changing Data Representations in an Evolving Scientific Domain Using Aspect-oriented Programming Techniques.
March R. McFadyen1 Principle of Least Knowledge – page 265 Principle: talk only to your immediate friends Also called Law of Demeter (LoD)
Oct 21, R. McFadyen1 Pure Fabrication P Problem: You have a responsibility to assign to a class, but assigning it to a class in the conceptual.
3/7/2003Bioinformatics1 How To Address Rapidly Changing Data Representations in an Evolving Scientific Domain Using Aspect-oriented Programming Techniques.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
Catalysis/Testing Catalysis Objects, components, and Frameworks with UML.
An Introduction to Software Architecture
Demeter Interfaces: AP without Surprises Prof. Karl Lieberherr and Therapon Skotiniotis, Jeffrey Palm.
Integrating Independent Components with On-Demand Remodularization based on OOPSLA 2002 paper by Mira Mezini Klaus Ostermann Prepared by Karl Lieberherr.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 27. Review UML dynamic view – State Diagrams.
Pattern Language for AP1 Pattern Language for Adaptive Programming (AP) Karl Lieberherr Northeastern University.
Expression evaluation E : S | C. S = int. C = Op E E. Op : A | M. A = “+”. M = “*”.
3/7/2003 ABB rapid change 1 How To Address Rapidly Changing Data Representations in an Evolving Scientific Domain Using Aspect-oriented Programming Techniques.
Slides for Gregor Kiczales Two versions –short version: Crosscutting capabilities for Java and AspectJ through DJ (4 viewgraphs only) –long version: Controlling.
A language to describe software texture in abstract design models and implementation.
Law of Demeter. What is it: Style Rule for building systems. Proposed by my research group: The Demeter Research Group in 1987, published in Covered.
Not only mark-up languages! There are other many other grammar formalisms and tools than XML. Some of them standardized (ASN). Even XML does not always.
Catalysis/Testing Catalysis Objects, components, and Frameworks with UML.
Drawbacks of object-oriented software development Lecture P12 T120B pavasario sem.
Pattern Language for AP1 Pattern Language for Adaptive Programming (AP) Karl Lieberherr Northeastern University.
CSG 7111 Structure and Interpretation of an Aspect Language for Datatype Karl Lieberherr.
Adaptive Software Kevin Cella Graduate Seminar 02/04/2005.
Demeter Aspects We study techniques for the emerging area of Aspect-Oriented Software Development and focus on the following areas:  Aspectual Collaborations.
Demeter Interfaces: AP without Surprises Prof. Karl Lieberherr and Therapon Skotiniotis, Jeffrey Palm.
Translating Traversals to AspectJ. Outline Motivation Demeter Process for Traversals AspectJ Translation Process.
DJ: traversal-visitor-style programming in Java Josh Marshall/ Doug Orleans Want to add more on traversal through collections and Aspectual Components.
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.
Pattern Language for AP1 Pattern Language for Adaptive Programming (AP) Karl Lieberherr Northeastern University.
UBC software modularity group 1/14/02 UCSD1 Discussion with Kiczales at UBC Ontology of AOP Ontology is the study of what there is, an inventory of what.
AO Mechanisms in Demeter1 Discussion with Gregor Kiczales at UBC Ontology of AOP Ontology is the study of what there is, an inventory of what exists. An.
The Law of Demeter For Operating System Course. Motivation Several programs were written in bad style Are difficult to maintain There is a simple remedy.
Talk only to your friends that share the same concerns (Law of Demeter for Concerns) Midterm Review February 2004.
Pattern Language for AP1 Pattern Language for Adaptive Programming (AP) Karl Lieberherr Northeastern University.
Crosscutting Capabilities for Java and AspectJ through DJ
Chapter 5 – Design and Implementation
Pattern Language for Adaptive Programming (AP)
Structure and Interpretation of an Aspect Language for Datatype
Discussion with Gregor Kiczales at UBC
Demeter Aspects Who We Are Aspectual Collaborations
Generic Programming using Adaptive and Aspect-Oriented Programming
Adaptive Object-Oriented Software Development
Smaller, More Evolvable Software
A Short Introduction to Adaptive Programming (AP) for Java Programmers
Software Design and Development
Review lecture AOO/Demeter.
Software Design and Development
A Short Introduction to Adaptive Programming (AP) for Java Programmers
Third lecture Review Visitor pattern DemeterJ 12/25/2018 SD.
Midterm Review CSU 670 Spring 2004.
AP/DJ AP: a generic technology
Adaptive and Aspect-Oriented Object-Oriented Software Development
Karl J. Lieberherr Northeastern University College of Computer Science
Lecture 21: Crosscutting Aspect-Oriented Programming Background
An Introduction to Software Architecture
Better Separation of Crosscutting Concerns with Aspectual Components
SAMANVITHA RAMAYANAM 18TH FEBRUARY 2010 CPE 691
Third lecture Review Visitor pattern DemeterJ 2/17/2019 SD.
Requirements for better object-oriented design and programming languages Could be organized better.
AOSD and the Law of Demeter: Shyness in Programming
Software Development CSU 670 Karl Lieberherr
Aspects at the Design Level
Objects, components, and Frameworks with UML
Karl Lieberherr Doug Orleans
Adaptive Programming in JAsCo
Law of Demeter (LoD) 7/23/2019 LoD
Presentation transcript:

ADAPTIVE PROGRAMMING Sezen ERDEM December 2005

Outline What is Adaptive Programming? Law of Demeter Structure-Shy Behavior (Traversal Strategy) Propagation Patterns Example Development Tools Conclusion November 19, 2018 Adaptive Programming

What is Adaptive Programming? Changes its behavior according to its environment Encapsulates class hierarchies using traversal strategies and visitors An extension of OOP using graph theory and formal languages to further abstract collaborating classes and generate a family of programs from a common architectural graph. November 19, 2018 Adaptive Programming

What is Adaptive Programming? Aspects or components use graphs which are described by traversal strategies. A traversal strategy defines traversals of graphs without referring to the details. Adaptive programming is aspect-oriented programming with traversal strategies. November 19, 2018 Adaptive Programming

What is Adaptive Programming? Adapts automatically to changing context Class structures are described partially Behavior is not implemented exhaustively Methods are implemented when they are needed November 19, 2018 Adaptive Programming

History 1982: Hades (Hardware DEScription language by Niklaus Wirth at ETH Zurich) 1982-1985: Zeus (brother of Hades, a silicon compilation language developed at Princeton University/MIT) 1985-Present: Demeter (sister of Zeus, used to implement Zeus, started at GTE Labs) November 19, 2018 Adaptive Programming

History (Cont’d) 1990: First traversal specifications 1995: Separation of Concerns by Huersch and Lopes started “untangling” movement. Collaboration with Xerox PARC began 1996: Gregor Kiczales and his group further develop Aspect Oriented Programming November 19, 2018 Adaptive Programming

Law of Demeter originally formulated as a style rule for designing object-oriented systems Each unit should have only limited knowledge about other units: only units "closely" related to the current unit. each unit should only talk to its friends DO NOT TALK TO STRANGERS !!! November 19, 2018 Adaptive Programming

Law of Demeter More specific case of Low Coupling Principle The motivation for the Law of Demeter is to control information overload When writing a method, one should not hardwire the details of the class structure into that method November 19, 2018 Adaptive Programming

Structure-Shy Behavior (Traversal Strategy) Programming is shy if it hides details of other concerns it cuts across Gathers the code describing the traversal in one place with minimal dependency on the class structure Compliant with Law of Demeter November 19, 2018 Adaptive Programming

Structure-Shy Behavior (Traversal Strategy) Allows one to specify strategies that ignore certain parts of the concrete structure Lowers the coupling of code from the concrete structure Lessens the dependency of code changes when structure changes Idea is to capture the essential structure and ignore the rest. November 19, 2018 Adaptive Programming

Structure-Shy Behavior An implementation of a concern C1 is C2-shy if: The C1 implementation relies only on minimal information of C2 implementations. The C1 implementation can adapt to small changes in C2 implementations. The C1 implementation is loosely coupled with C2 implementations. The C1 implementation can work with C2’ , C2’’ , C2’’’ which are close or similar to C2 implementations. November 19, 2018 Adaptive Programming

Structure-Shy Behaviour ordinary program better program structure-shy functionality Components structure Aspect 1 avoid tangled programs AOP synchronization Aspect 2 November 19, 2018 Adaptive Programming

Propagation Patterns Adaptive program is specified using a collection of propagation patterns. Propagation patterns specify a set of related constraints in the adaptive program Given a customizing Class Dictionary Graph, a propagation pattern produces an OO program denoted by the adaptive program it specifies November 19, 2018 Adaptive Programming

Class Dictionary Graph November 19, 2018 Adaptive Programming

Class Dictionary Graph Vertices Construction Vertex : Abstraction of a classs definition Alternation Vertex: Define union classes Repetition Vertex : Represents lists Edges Alternation Edges: Represents alternative relationship Construction Edges: Represents parts November 19, 2018 Adaptive Programming

Class Dictionary Graph November 19, 2018 Adaptive Programming

Propagation Graph Customize a propagation pattern with class dictionary graph, its traversal specifications induce a set of paths Propagation Graph: Sum up the total salary of officers November 19, 2018 Adaptive Programming

Propagation Graph – Code Generation For each vertex in the propagation graph: A method is created with the signature given by the operation specification in the propagation pattern. The body for this method contains as many calls as the given vertex has outgoing construction edges in the propagation graph. Each call is made to the method with the same signature attached to the vertex target of the corresponding construction edge. Finally, each wrapper code fragment in the propagation pattern is prefixed or appended to the generated code for the vertex or edge it specifies. November 19, 2018 Adaptive Programming

Example busStops BusRoute BusStopList buses 0..* BusStop BusList UML CLASS DIAGRAM busStops BusRoute BusStopList buses 0..* BusStop BusList Example for developing strategies and writing adaptive programs waiting 0..* passengers Bus PersonList Person 0..* November 19, 2018 Adaptive Programming

Collaborating Classes find all people waiting at any bus stop on a bus route busStops BusRoute BusStopList buses 0..* BusStop BusList waiting 0..* passengers Bus PersonList Person 0..* November 19, 2018 Adaptive Programming

Traversal Strategy from BusRoute through BusStop to Person busStops BusStopList buses one method for each red class 0..* BusStop BusList waiting 0..* passengers Bus PersonList Person 0..* November 19, 2018 Adaptive Programming

Traversal Strategy from BusRoute bypassing Bus to Person busStops BusStopList buses 0..* BusStop BusList waiting 0..* passengers Bus PersonList Person 0..* November 19, 2018 Adaptive Programming

Robustness of Strategy from BusRoute through BusStop to Person villages BusRoute BusStopList busses VillageList busStops 0..* 0..* BusStop BusList Village waiting 0..* passengers Bus PersonList Person 0..* November 19, 2018 Adaptive Programming

DJ: Implementation class BusRoute { int countPersons(TraversalGraph WP) { Integer result = (Integer)WP.traverse(this, new Visitor() { int r ; public void before(Person host){ r++; } public void start() { r = 0;} public Object getReturnValue() {return new Integer ( r);} }); return result.intValue(); } November 19, 2018 Adaptive Programming

DJ: Implementation ClassGraph classGraph = new ClassGraph(); TraversalGraph WPTraversal = new TraversalGraph (“from BusRoute via BusStop to Person”, classGraph); int r = aBusRoute.countPersons(WPTraversal); November 19, 2018 Adaptive Programming

Taxi driver analogy Streets and intersections correspond to class graph Traversal strategy determines how the taxi will navigate through the streets You can take pictures before and after intersections You can veto sub traversals November 19, 2018 Adaptive Programming

Development Tools DJ and AP Library Demeter/C++ DemeterJ Demeter/StKlos Dem/Perl5 Dem/C++ Dem/CLOS Demeter/Object Pascal this technology is catching on November 19, 2018 Adaptive Programming

Advantages of AP Focus on the essence of a problem to be solved and leads to simpler and shorter than conventional object-oriented programs. Promote reuse. Robust to changes Design matches program More understandable code Improved productivity November 19, 2018 Adaptive Programming

Conclusion We covered What Adaptive Programming is Law of Demeter Traversal Strategies Propagation Patterns Development Tools Advantages of Adaptive Programming November 19, 2018 Adaptive Programming

References http://www.ccs.neu.edu/research/demeter Adaptive Object Oriented Software Karl Liebher Adaptive Programming Mohammed G. Gauda – Ted Herman November 19, 2018 Adaptive Programming

QUESTIONS November 19, 2018 Adaptive Programming