Problem with Java and - PowerPoint PPT Presentation

About This Presentation
Title:

Problem with Java and

Description:

This leads to unnecessary traversals and traversal graphs that ... Route1:BusRoute :Vector. busStops. CentralSquare:BusStop :PersonList. waiting. Paul:Person ... – PowerPoint PPT presentation

Number of Views:16
Avg rating:3.0/5.0
Slides: 17
Provided by: karllie
Category:
Tags: java | problem | route1

less

Transcript and Presenter's Notes

Title: Problem with Java and


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
Traversal Strategy
find all persons waiting at any bus stop on a bus
route
from BusRoute through BusStop to Person
busStops
BusRoute
BusStopList
buses
0..
BusStop
BusList
waiting
0..
passengers
Bus
PersonList
Person
0..
6
Traversal Strategy
find all persons waiting at any bus stop on a bus
route
from BusRoute through BusStop to Person
busStops
BusRoute
BusStopList
Vector
buses
0..
BusStop
Object
BusList
waiting
0..
passengers
Bus
PersonList
Person
0..
7
Traversal Strategy
find all persons waiting at any bus stop on a bus
route
from BusRoute through BusStop to Person
busStops
BusRoute
BusStopList
Vector
buses
0..
BusStop
Object
BusList
waiting
passengers
Bus
PersonList
visit all Bus-objects and stop at them.
Person
0..
8
ObjectGraph Traversal
Bus17Bus
Vector
Route1BusRoute
buses
Bus16Bus
busStops
Vector
Bus15Bus
passengers
CentralSquareBusStop
waiting
PersonList
PersonList
JoanPerson
PaulPerson
SeemaPerson
EricPerson
9
ObjectGraph Traversal
Bus17Bus
Vector
Route1BusRoute
buses
Bus16Bus
busStops
Vector
Bus15Bus
passengers
CentralSquareBusStop
waiting
PersonList
PersonList
JoanPerson
PaulPerson
SeemaPerson
EricPerson
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
  • Lets 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. Lets assume we also have a class XB.

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.
Write a Comment
User Comments (0)
About PowerShow.com