Lecture 21: Crosscutting Aspect-Oriented Programming Background

Slides:



Advertisements
Similar presentations
February R. McFadyen1 Polymorphism Indirection Pure Fabrication Protected Variations (Law of Demeter) More GRASP Patterns.
Advertisements

October R. McFadyen1 Polymorphism Indirection Pure Fabrication Protected Variations (Law of Demeter) Ch 22: 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.
April 3, R McFadyen1 Recall UML Class Diagram BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..*
Lecture #4 Agenda Cell phones off & name signs out Review Questions? Objects The birds-and-the-bees talk.
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.
Fall 2005CSE 115/503 Introduction to Computer Science I1 Lecture #4 Agenda Announcements Review Questions? Classes and objects UML class diagrams Creating.
March 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.
Catalysis/Testing Catalysis Objects, components, and Frameworks with UML.
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.
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.
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.
Problem with Java and how it causes a problem for DJ.
Pattern Language for AP1 Pattern Language for Adaptive Programming (AP) Karl Lieberherr Northeastern University.
Designing Lego Labs Using Lejos and Mindstorms Adapted from Lynn Stein “Radically ReThinking CS1” NSF Workshop.
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.
(Thunking about Thunks)
Lecture 4: Metacircles Eval Apply David Evans
Viewgraphs for Semantics
Crosscutting Capabilities for Java and AspectJ through DJ
Lecture 6: Lambda Calculus
Pattern Language for Adaptive Programming (AP)
Lecture 2: Schreme David Evans
Chapter 5: Object Oriented Analysis and Design
Structure and Interpretation of an Aspect Language for Datatype
Lambda Calculus Revisited
Demeter Aspects Who We Are Aspectual Collaborations
Adaptive Object-Oriented Software Development
Smaller, More Evolvable Software
Lecture 21: Crosscutting Aspect-Oriented Programming
Software Design and Development
ADAPTIVE PROGRAMMING Sezen ERDEM December 2005.
Review lecture AOO/Demeter.
Software Design and Development
Midterm Review CSU 670 Spring 2004.
AP/DJ AP: a generic technology
Adaptive and Aspect-Oriented Object-Oriented Software Development
Lecture 10: The Return of Paco Background just got here last week
Better Separation of Crosscutting Concerns with Aspectual Components
Lecture 10: Using Object-Oriented Languages
AOSD and the Law of Demeter: Shyness in Programming
Software Development CSU 670 Karl Lieberherr
Lecture 19: Proof-Carrying Code Background just got here last week
Lecture 10: Fixed Points ad Infinitum M.C. Escher, Moebius Ants
Aspects at the Design Level
Objects, components, and Frameworks with UML
David Evans Lecture 19: ||ism I don’t think we have found the right programming concepts for parallel computers yet.
Lecture 13: Proof-Carrying Code Background just got here last week
Lecture 12: Minding your Ps & Qs:
Lecture 5: DES Use and Analysis Background just got here last week
Lecture 14: Mocking Mockingbirds
Lecture 15: Crazy Eddie and the Fixed Points Background
Aspect Oriented Software Design
Karl Lieberherr Doug Orleans
Adaptive Programming in JAsCo
Group 4: Song Li, Ying Lu, Hexin Wang, and Michael Walker May 1, 2000
Week 7 - Friday CS 113.
Presentation transcript:

David Evans http://www.cs.virginia.edu/~evans Lecture 21: Crosscutting Aspect-Oriented Programming Background just got here last week finished degree at MIT week before Philosophy of advising students don’t come to grad school to implement someone else’s idea can get paid more to do that in industry learn to be a researcher important part of that is deciding what problems and ideas are worth spending time on grad students should have their own project looking for students who can come up with their own ideas for research will take good students interested in things I’m interested in – systems, programming languages & compilers, security rest of talk – give you a flavor of the kinds of things I am interested in meant to give you ideas (hopefully even inspiration!) but not meant to suggest what you should work on CS655: Programming Languages University of Virginia Computer Science David Evans http://www.cs.virginia.edu/~evans

Adaptive Programming: Demeter Instance of AOP [Lieberherr92] Separate the program text and the class structure Program is independent of class graph Accomplish tasks by traversals Specification for what parts of received object should be traversed Code fragments for what to execute when specific object types are encountered 15 January 2019 University of Virginia CS 655

University of Virginia CS 655 Law of Demeter Law of Demeter: a method should talk only to its friends: arguments and part objects (computed or stored) newly created objects Dilemma: Small method problem of OO (if followed) Unmaintainable code (if not followed) Traversal strategies are the solution to this dilemma Demeter = Greek Goddess of Agriculture (grow software from small blocks) 15 January 2019 University of Virginia CS 655

AP Example: UML Class Diagram Slide adapted from Karl Lieberherr talk AP Example: UML Class Diagram busStops BusRoute BusStopList buses 0..* BusStop BusList waiting 0..* passengers Example for developing strategies and writing adaptive programs Bus PersonList Person 0..* 1/15/2019 AOP/Demeter

Collaborating Classes Slide adapted from Karl Lieberherr talk Collaborating Classes Find all persons waiting at any bus stop on a bus route busStops BusRoute BusStopList OO solution: one method for each red class buses 0..* BusStop BusList waiting 0..* passengers Bus PersonList Person 0..* 1/15/2019 AOP/Demeter

Java Solution (excerpt) class BusRoute { BusStopList busstops; void printWaitingPassengers () { busstops->printWaitingPassengers (); } } class BusStopList { BusStop stops[]; for (int i = 0; i < stops.length; i++) stops[i].printWaitingPassengers (); 15 January 2019 University of Virginia CS 655

University of Virginia CS 655 Java Solution (cont.) class BusStop { PersonList waiting; void printWaitingPassengers () { waiting.print (); } } class PersonList { Person people[]; void print () { for (int i = 0; i < people.length; i++) people[i].print (); } class Person { String name; void print () { System.stdout.println (name); } } 15 January 2019 University of Virginia CS 655

University of Virginia CS 655 Demeter Approach Devise a traversal strategy Specify code for different types of objects reached on a traversal Example: code prints name if object is a Person Independent of class graph 15 January 2019 University of Virginia CS 655

Slide adapted from Karl Lieberherr talk Traversal Strategy First try: from BusRoute to Person busStops BusRoute BusRoute BusStopList BusStopList buses 0..* BusStop BusStop BusList BusList waiting 0..* passengers Bus Bus PersonList PersonList Person Person 0..* 1/15/2019 AOP/Demeter

Slide adapted from Karl Lieberherr talk Traversal Strategy from BusRoute through BusStop to Person busStops BusRoute BusStopList buses 0..* BusStop BusList waiting 0..* passengers Bus PersonList Person 0..* 1/15/2019 AOP/Demeter

Robustness of Strategy Slide adapted from Karl Lieberherr talk Robustness of Strategy from BusRoute bypassing Bus to Person villages BusRoute BusStopList buses VillageList busStops 0..* 0..* BusStop BusList Village waiting 0..* passengers Bus PersonList Person 0..* 1/15/2019 AOP/Demeter

Filter out noise in class diagram Slide adapted from Karl Lieberherr talk Filter out noise in class diagram only three out of seven classes are mentioned in traversal strategy! from BusRoute through BusStop to Person explain why strategy better replaces traversal methods for the classes BusRoute VillageList Village BusStopList BusStop PersonList Person 1/15/2019 AOP/Demeter

University of Virginia CS 655 Summary Aspect-Oriented Programming and Adaptive Programming provide programmers with new expressive options Active research area (Separation of Concerns Workshops at OOPSLA, ICSE, ECOOP, etc.) Many directions to explore 15 January 2019 University of Virginia CS 655