1 / 16

Problem with Java and

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.

sue
Download Presentation

Problem with Java and

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. 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.

  3. 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.

  4. BList A * X B Vector * Object A X B

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

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

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

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

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

  10. 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.

  11. 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.

  12. 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!!! Vector * Object A X B

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

  14. 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.

  15. 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.

  16. 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.

More Related