Problem with Java and how it causes a problem for DJ.

Slides:



Advertisements
Similar presentations
Bus Stop Signal System. Scene 1 A passenger is trying to hail a right bus…
Advertisements

Global States.
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
February R. McFadyen1 Polymorphism Indirection Pure Fabrication Protected Variations (Law of Demeter) More GRASP Patterns.
Java.  Java is an object-oriented programming language.  Java is important to us because Android programming uses Java.  However, Java is much more.
Home Page 1 Give directions here. Quiz Questions This yellow button hyperlinks to the question template. You can duplicate this button and change the.
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..*
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.
20 September 2006 Interaction Design at ITU, Fall 2006 Simona Maschi and Heather Martin WAITING EXPERIENCE.
Queues Chapter 6. Chapter 6: Queues2 Chapter Objectives To learn how to represent a waiting line (queue) and how to use the methods in the Queue interface.
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.
Tool Check!. Ordered Pairs Unit 11 Lesson 2 Suppose you used a coordinate plane to identify the location of a mountain peak as a part of a story problem.
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.
Demeter and Aspects1 AOSD 2002 Tutorial: Demeter Aspect-Oriented Programming of Traversal Related Concerns in Java Demeter Research Group.
Coverage – “Systematic” Testing Chapter 20. Dividing the input space for failure search Testing requires selecting inputs to try on the program, but how.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
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 = “*”.
AP/DJ AP: a generic technology DJ: a low-learning-curve implementation of AP.
 Expression Tree and Objects 1. Elements of Python  Literals, Strings, Tuples, Lists, …  The order of file reading  The order of execution 2.
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.
Queues Chapter 6. Chapter 6: Queues Chapter Objectives To learn how to represent a waiting line (queue) and how to use the five methods in the Queue interface:
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.
Integer Programming (정수계획법)
Translating Traversals to AspectJ. Outline Motivation Demeter Process for Traversals AspectJ Translation Process.
Consultant Presentation Group B5. Presentation Outline Introduction How to design by Group A5 Future Data Structure Interface Future Conclusion.
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
DJ: traversal-visitor-style programming in Java Josh Marshall/ Doug Orleans Want to add more on traversal through collections and Aspectual Components.
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.
Talk only to your friends that share the same concerns (Law of Demeter for Concerns) Midterm Review February 2004.
Jesse proposal1 Jesse’s proposal Karl Lieberherr.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Pattern Language for AP1 Pattern Language for Adaptive Programming (AP) Karl Lieberherr Northeastern University.
Testing. Aspects of Quality Software Flexibility Extensibility Correctness Robustness Reliability Safety Usability.
AP/DJ AP: a generic technology
Viewgraphs for Semantics
Crosscutting Capabilities for Java and AspectJ through DJ
Pattern Language for Adaptive Programming (AP)
Good for DJ over Java Extending traversals for collections (b..*)
Structure and Interpretation of an Aspect Language for Datatype
Cse 373 May 15th – Iterators.
Adaptive Object-Oriented Software Development
A Short Introduction to Adaptive Programming (AP) for Java Programmers
A Short Introduction to Adaptive Programming (AP) with collaborations and adapters Northeastern Team 11/16/2018 DJ.
Software Design and Development
ADAPTIVE PROGRAMMING Sezen ERDEM December 2005.
Single-Source All-Destinations Shortest Paths With Negative Costs
Software Design and Development
A Short Introduction to Adaptive Programming (AP) for Java Programmers
Single-Source All-Destinations Shortest Paths With Negative Costs
Midterm Review CSU 670 Spring 2004.
AP/DJ AP: a generic technology
Lecture 21: Crosscutting Aspect-Oriented Programming Background
Software Development CSU 670 Karl Lieberherr
Aspects at the Design Level
Objects, components, and Frameworks with UML
Reasons for unnecessary route changes: (1) not knowing the cause
Karl Lieberherr Doug Orleans
Presentation transcript:

Problem with Java and how it causes a problem for DJ

Problem with Java and DJ What is coming is not about a problem of DJ but about a problem with Java: the lack of parameterized classes. The lack of parameterized classes forces the use of class Object which, as the mother of all classes, is too well connected. This leads to unnecessary traversals and traversal graphs that are too big.

DJ Traversals are opportunistic If there is a possibility that an object o may be on a path to success, o is visited. The decision whether there is a possibility is made based on whether there is a path in the class graph. The presence of class Object in a path in the class graph drastically increases the possibilities.

A X Object B Vector * A XB * BList

Traversal Strategy BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..* from BusRoute through BusStop to Person find all persons waiting at any bus stop on a bus route

Traversal Strategy BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..* from BusRoute through BusStop to Person find all persons waiting at any bus stop on a bus route Object Vector

Traversal Strategy BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..* from BusRoute through BusStop to Person find all persons waiting at any bus stop on a bus route Object Vector visit all Bus-objects and stop at them.

ObjectGraph Traversal Route1:BusRoute :Vector busStops CentralSquare:BusStop :PersonList waiting Paul:PersonSeema:Person :Vector buses Bus15:Bus :PersonList passengers Joan:Person Eric:Person Bus16:Bus Bus17:Bus

ObjectGraph Traversal Route1:BusRoute :Vector busStops CentralSquare:BusStop :PersonList waiting Paul:PersonSeema:Person :Vector buses Bus15:Bus :PersonList passengers Joan:Person Eric:Person Bus16:Bus Bus17:Bus

Unnecessary Traversal The traversal goes through the buses link although there will be no Bus-objects in that vector. But in Java, when we use a Vector-object, we cannot express in the class graph that we have only Bus-objects in that collection.

Lack of parameterized classes in Java makes DJ harder to use Consider the traversal: from A to B Let’s assume that in the class graph between A and B there is a Java collection class. The intent is: A = List(B) which we cannot express in Java. Instead we have: A = Vector(Object). Object : A | B. Let’s assume we also have a class X=B.

Lack of parameterized classes in Java makes DJ harder to use We have: A = Vector(Object). Object : A | B | X. X = B. If the vector contains an X object it will be traversed!!! A X Object B Vector *

A X Object B Vector * A XB * No X-object is allowed to be in vector

Moral of the story If the Collection objects contain only the objects advertised in the nice class graph of the application the traversal done by DJ will be correct. But unnecessary traversals still happen. However, if the Collection objects contain additional objects (like an X-object) they will be traversed accidentally.

Moral of the story Java should have parameterized classes. Workaround: Use a JSR (Java Specification Request) 31 approach: use a schema notation with parameterization to express class graph and generate Java code from schema. For traversal computation, the schema will be used.

Size of traversal graph DJ might create big traversal graphs when collection classes are involved. DJ will plan for all possibilities even though only a small subset will be realized during execution. To reduce the size of the traversal graph, you need to use bypassing. In the example: from A bypassing {A,X} to B.