AP/DJ AP: a generic technology

Slides:



Advertisements
Similar presentations
Chapter Five Functions
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..*
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.
CS 206 Introduction to Computer Science II 10 / 14 / 2009 Instructor: Michael Eckmann.
Fall 2009ACS-3913 R. McFadyen1 Protected Variations Principle: How do you design so that variations in the future do not have an undesirable affect on.
March 6, R. McFadyen1 Pure Fabrication P Problem: You have a responsibility to assign to a class, but assigning it to a class in the.
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.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Sumant Tambe, et. al LEESA DSPD 2008 An Embedded Declarative Language for Hierarchical Object Structure Traversal Sumant Tambe* Aniruddha Gokhale Vanderbilt.
3/7/2003Bioinformatics1 How To Address Rapidly Changing Data Representations in an Evolving Scientific Domain Using Aspect-oriented Programming Techniques.
Learners Support Publications Pointers, Virtual Functions and Polymorphism.
Sumant Tambe, et. al LEESA DSPD 2008 An Embedded Declarative Language for Hierarchical Object Structure Traversal Sumant Tambe* Aniruddha Gokhale Vanderbilt.
Design patterns. What is a design pattern? Christopher Alexander: «The pattern describes a problem which again and again occurs in the work, as well as.
Tunis International Centre for Environmental Technologies Small Seminar on Networking Technology Information Centers UNFCCC secretariat offices Bonn, Germany.
Ideas to Improve SharePoint Usage 4. What are these 4 Ideas? 1. 7 Steps to check SharePoint Health 2. Avoid common Deployment Mistakes 3. Analyze SharePoint.
Pattern Language for AP1 Pattern Language for Adaptive Programming (AP) Karl Lieberherr Northeastern University.
AP/DJ AP: a generic technology DJ: a low-learning-curve implementation of AP.
TOOLS USA '99 Interaction Schemata: Compiling Interactions to Code Neeraj Sangal, Edward Farrell, Tendril Software, Inc, Westford, MA
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.
Parameter Passing Mechanisms Reference Parameters § §
Pattern Language for AP1 Pattern Language for Adaptive Programming (AP) Karl Lieberherr Northeastern University.
Adaptive Software Kevin Cella Graduate Seminar 02/04/2005.
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.
Watching the movie the hard way…. Page 256 – Head First Design Patterns.
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.
Good for DJ over Java Extending traversals for b..* –returning a single object instead of a collection (Find) –modifying the collection (Add, Delete)
Pattern Language for AP1 Pattern Language for Adaptive Programming (AP) Karl Lieberherr Northeastern University.
R-customizers Goal: define relation between graph and its customizers, study domains of adaptive programs, merging of interface class graphs.
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.
Lecture 7 Discuss midterm Scheduling. Alternative Directory Structure See hw 1 and hw 2. This one more aligned with UNIX directory structure. Idea for.
1 The Law of Demeter By Rick Mercer with help from Object-Oriented Design Heuristics, Arthur Riel Addison-Wesley, 1996, ISBN X and Applying.
Software Engineering Algorithms, Compilers, & Lifecycle.
Pattern Language for AP1 Pattern Language for Adaptive Programming (AP) Karl Lieberherr Northeastern University.
AP/DJ AP: a generic technology
Generic Programming in C
Introduction to Design Patterns
Regarding homework 9 Many low grades
Pattern Language for Adaptive Programming (AP)
MSc/ICY Software Workshop , Semester 2
Good for DJ over Java Extending traversals for collections (b..*)
Chapter 4: Writing Classes
CS212: Object Oriented Analysis and Design
The Law of Demeter (LoD) and how it should be used
The Law of Demeter (LoD) and how it should be used
Adaptive Object-Oriented Software Development
Lecture 6 Project review
Software Design and Development
ADAPTIVE PROGRAMMING Sezen ERDEM December 2005.
Third lecture Review Visitor pattern DemeterJ 12/25/2018 SD.
Midterm Review CSU 670 Spring 2004.
Karl J. Lieberherr Northeastern University College of Computer Science
Lecture 21: Crosscutting Aspect-Oriented Programming Background
Better Separation of Crosscutting Concerns with Aspectual Components
Binary Trees: Motivation
Third lecture Review Visitor pattern DemeterJ 2/17/2019 SD.
Requirements for better object-oriented design and programming languages Could be organized better.
Lecture 8 Evolution of object behavior Behavioral patterns
APPCs revisited 2/25/2019 APPCs revisited.
Options for Demeter intergration into AspectJ
Predefined Functions Revisited
Karl Lieberherr Doug Orleans
Adaptive Programming in JAsCo
Law of Demeter (LoD) 7/23/2019 LoD
Presentation transcript:

AP/DJ AP: a generic technology DJ: a low-learning-curve implementation of AP

From Mike Mannion Regarding DOM navigation, I would be very interested in taking a look at the library you mention (DJ). Can I use XPath expressions to navigate a DOM within Java? That would be very useful indeed!

Law of Demeter Principle Each unit should only have limited knowledge about other units: only about units “closely” related to the current unit. “Each unit should only talk to its friends.” “Don’t talk to strangers.” Main Motivation: Control information overload. We can only keep a limited set of items in short-term memory.

Law of Demeter FRIENDS

Application to OO Unit = method closely related = methods of class of this/self and other argument classes methods of immediate part classes (classes that are return types of methods of class of this/self) In the following we talk about this application of the Law of Demeter Principle to OO

Rumbaugh and the Law of Demeter Quote: Avoid traversing multiple links or methods. A method should have limited knowledge of an object model. A method must be able to traverse links to obtain its neighbors and must be able to call operations on them, but it should not traverse a second link from the neighbor to a third class.

Law of Demeter (alternative formulation) A method should have limited knowledge of an object model. AP is a reaction to this view of the Law of Demeter

Agreement that LoD Good Idea How to follow LoD: good solutions exist but not widely known. Two approaches to following LoD: OO approach Adaptive approaches DJ APPC Demeter/Java

DJ An implementation of AP using only the DJ library and the Java Generic Library (JGL) All programs written in pure Java Intended as prototyping tool: makes heavy use of introspection in Java Integrates Generic Programming (a la STL) and Adaptive programming

Integration of Generic and Adaptive Programming A traversal specification turns an object graph into a container. Can invoke 50+ generic algorithms on those containers. Examples: add, delete, find, etc. What is gained: genericity not only with respect to data structure implementations but also with respect to class graph

Sample DJ code // Find the user with the specified uid Container libUsers = new Container(library, "from Library to User"); User user = libUsers.find("uid", uid);

In addition: Traverse method: excellent support for Visitor Pattern // class ClassGraph Object traverse(Object o, Strategy s, Visitor v); traverse navigates through Object o following traversal specification s and executing the before and after methods in visitor v ClassGraph is computed using introspection

Using DJ: BusRoute example public int count (){ // class BusRoute getT().traverse( this, new Visitor(){ int r; public void before(Person host) { r++; } public void start() { r = 0;} …) }

Using DJ TraversalGraph getT() {return new TraversalGraph( classGraph1, new Strategy( “from BusRoute via BusStop to Person”));}

More info DJ Home Page: www.ccs.neu.edu/research/demeter/DJ