visualising java data structures as graphs
play

Visualising Java Data Structures as Graphs John Hamer Department of - PowerPoint PPT Presentation

Visualising Java Data Structures as Graphs John Hamer Department of Computer Science University of Auckland J.Hamer@cs.auckland.ac.nz John Hamer, January 15, 2004 ACE2004Visualising Java Data Structures as Graphs p. 1/21 The Idea


  1. Visualising Java Data Structures as Graphs John Hamer Department of Computer Science University of Auckland J.Hamer@cs.auckland.ac.nz John Hamer, January 15, 2004 ACE’2004—Visualising Java Data Structures as Graphs – p. 1/21

  2. The Idea ■ Student code calls the static method ● The Idea ● Example Dot.drawGraph( whatever ) ● About GraphViz ● Related work ● Principles ■ whatever can be any Java object. ● Features of our tool ● Overcoming student misconceptions ■ Dot.drawGraph ● Visualising the Java data model ● Degrees of faithfulness ◆ traverses the object’s fields using Java reflection ● The Full Monty ● Hide the internal state ◆ outputs a GraphViz format graph description to a text file ● Pretend it’s primitive ● Limitations and future work ◆ runs the GraphViz processor to produce a PNG (or EPS, ● Summary and conclusions ● A view of an “Arne” Tree etc.) picture ■ Student views the sequence of pictures using a standard viewer John Hamer, January 15, 2004 ACE’2004—Visualising Java Data Structures as Graphs – p. 2/21

  3. Example ● The Idea ● Example ● About GraphViz ● Related work ● Principles public static void main( String[] args ) { ● Features of our tool ● Overcoming student misconceptions List xs = new LinkedList( ); ● Visualising the Java data model ● Degrees of faithfulness for( int i = 0; i < 4; i++ ) { ● The Full Monty ● Hide the internal state Dot.drawGraph( xs ); ● Pretend it’s primitive ● Limitations and future work ● Summary and conclusions xs.add( new Integer(i+100) ); ● A view of an “Arne” Tree } } John Hamer, January 15, 2004 ACE’2004—Visualising Java Data Structures as Graphs – p. 3/21

  4. Frame #1 ● The Idea ● Example LinkedList size: 0 ● About GraphViz ● Related work ● Principles ● Features of our tool header ● Overcoming student misconceptions ● Visualising the Java data model ● Degrees of faithfulness ● The Full Monty Entry element: null next previous ● Hide the internal state ● Pretend it’s primitive ● Limitations and future work ● Summary and conclusions ● A view of an “Arne” Tree John Hamer, January 15, 2004 ACE’2004—Visualising Java Data Structures as Graphs – p. 4/21

  5. Frame #2 ● The Idea ● Example LinkedList size: 1 ● About GraphViz ● Related work ● Principles ● Features of our tool header ● Overcoming student misconceptions ● Visualising the Java data model ● Degrees of faithfulness ● The Full Monty Entry element: null ● Hide the internal state ● Pretend it’s primitive ● Limitations and future work ● Summary and conclusions next previous next previous ● A view of an “Arne” Tree Entry element: 100 John Hamer, January 15, 2004 ACE’2004—Visualising Java Data Structures as Graphs – p. 5/21

  6. Frame #3 ● The Idea ● Example LinkedList size: 2 ● About GraphViz ● Related work ● Principles ● Features of our tool header ● Overcoming student misconceptions ● Visualising the Java data model ● Degrees of faithfulness ● The Full Monty Entry element: null ● Hide the internal state ● Pretend it’s primitive ● Limitations and future work ● Summary and conclusions next previous ● A view of an “Arne” Tree Entry element: 100 previous next next previous Entry element: 101 John Hamer, January 15, 2004 ACE’2004—Visualising Java Data Structures as Graphs – p. 6/21

  7. Frame #4 ● The Idea ● Example LinkedList size: 3 ● About GraphViz ● Related work ● Principles header ● Features of our tool ● Overcoming student misconceptions ● Visualising the Java data model Entry element: null ● Degrees of faithfulness ● The Full Monty ● Hide the internal state next previous ● Pretend it’s primitive ● Limitations and future work ● Summary and conclusions Entry element: 100 ● A view of an “Arne” Tree next previous previous next Entry element: 101 next previous Entry element: 102 John Hamer, January 15, 2004 ACE’2004—Visualising Java Data Structures as Graphs – p. 7/21

  8. Frame #4 coloured ● The Idea ● Example LinkedList size: 3 ● About GraphViz ● Related work ● Principles header ● Features of our tool ● Overcoming student misconceptions Entry element: null ● Visualising the Java data model ● Degrees of faithfulness ● The Full Monty next previous ● Hide the internal state ● Pretend it’s primitive Entry element: 100 ● Limitations and future work ● Summary and conclusions ● A view of an “Arne” Tree next previous previous next Entry element: 101 next previous Entry element: 102 Dot.Context ctx = Dot.defaultContext( ); ctx.setFieldAttribute( "next", "color=blue" ); ctx.setFieldAttribute( "previous", "color=red" ); John Hamer, January 15, 2004 ACE’2004—Visualising Java Data Structures as Graphs – p. 8/21

  9. About GraphViz ■ GraphViz is a widely used, freely available graph drawing ● The Idea ● Example program, developed at ATT; see www.graphviz.org ● About GraphViz ● Related work ● Principles ■ Layout is completely automatic and (generally) æsthetically ● Features of our tool ● Overcoming student misconceptions pleasing. ● Visualising the Java data model ● Degrees of faithfulness ■ Text input for nodes and edges, with optional attributes ● The Full Monty ● Hide the internal state (colour, node shape, labels, fonts, etc.). ● Pretend it’s primitive ● Limitations and future work ■ Output to a variety of formats (PNG, EPS, SVG, . . . ) ● Summary and conclusions ● A view of an “Arne” Tree John Hamer, January 15, 2004 ACE’2004—Visualising Java Data Structures as Graphs – p. 9/21

  10. Related work ■ Brocard —Perl interface to GraphViz for ● The Idea GraphViz ● Example visualising data structures; also regular expressions, ● About GraphViz ● Related work grammars, XML, call graph, profiling, . . . . ● Principles ● Features of our tool ■ North & Koutsofios —visual debugger, vdbx ● Overcoming student misconceptions ● Visualising the Java data model ● Degrees of faithfulness ■ Thomas Naps’ Visualiser class. Canned Visualisation ● The Full Monty ● Hide the internal state collection of visualisations: numeric arrays (bar, ● Pretend it’s primitive ● Limitations and future work scattergram, data views), general arrays, stacks, ● Summary and conclusions ● A view of an “Arne” Tree queues, linked lists, binary trees, general trees, graphs, networks. John Hamer, January 15, 2004 ACE’2004—Visualising Java Data Structures as Graphs – p. 10/21

  11. Principles ■ Students must be engaged in active learning; ● The Idea ● Example ● About GraphViz ■ tools need to be simple to use; ● Related work ● Principles ■ avoid distracting students from substantive course material; ● Features of our tool ● Overcoming student misconceptions ■ for instructors, minimise the effort required to integrate tools ● Visualising the Java data model ● Degrees of faithfulness into the curriculum; ● The Full Monty ● Hide the internal state ● Pretend it’s primitive ■ software must be reliable. ● Limitations and future work ● Summary and conclusions ● A view of an “Arne” Tree John Hamer, January 15, 2004 ACE’2004—Visualising Java Data Structures as Graphs – p. 11/21

  12. Features of our tool ■ trivial to setup and easy to use (source < 600 lines); ● The Idea ● Example ● About GraphViz ■ active learning —students decide where to place the calls ● Related work ● Principles to drawGraph , what to elide; ● Features of our tool ● Overcoming student misconceptions ■ connects code with the Java data model; ● Visualising the Java data model ● Degrees of faithfulness ■ usable on any Java program; no specific programming ● The Full Monty ● Hide the internal state conventions necessary; ● Pretend it’s primitive ● Limitations and future work ■ allows “wrong” data structures to be viewed (as well as ● Summary and conclusions ● A view of an “Arne” Tree correct ones); ■ configuration allows broad and precise elision of detail; ■ visualisations can be incorporated in reports, www pages, and presentations. John Hamer, January 15, 2004 ACE’2004—Visualising Java Data Structures as Graphs – p. 12/21

  13. Overcoming student misconceptions Java has a simple data model, right? ● The Idea ● Example ■ Strings are objects, but string constants look like primitive ● About GraphViz ● Related work values. ● Principles ● Features of our tool ■ Assignment of objects is by reference, primitive types by ● Overcoming student misconceptions ● Visualising the Java data model value. ● Degrees of faithfulness ● The Full Monty ● Hide the internal state ■ Object arrays hold references, not values. ● Pretend it’s primitive ● Limitations and future work ■ 2-dimensional arrays are constructed from 1-d arrays (is it ● Summary and conclusions ● A view of an “Arne” Tree row or column order?) ■ Static fields are not part of any object. ■ Inheritance means objects are often not the same as their declared types. John Hamer, January 15, 2004 ACE’2004—Visualising Java Data Structures as Graphs – p. 13/21

Recommend


More recommend