sorting out sorting: a case study of software visualization for teaching computer science ronald...
TRANSCRIPT
SORTING OUT SORTING: A CASE STUDY OF SOFTWARE VISUALIZATION FOR TEACHING
COMPUTER SCIENCE
Ronald Baecker University of Toronto
Presented by David Burlinson
2/25/2015
OUTLINE
Introduction and Background
Sorting out Sorting Problems Solutions Analysis
Discussion
INTRODUCTION AND BACKGROUND Visualization in Computer Science Education
Drawings and diagrams to represent concepts Professors covering blackboards (and themselves) with chalk Students sketching hurried representations Data structures, control flow, hierarchies, pointer chains, nesting of procedures, scope of variables, memory allocation..
Drawbacks?
INTRODUCTION AND BACKGROUND
Program behavior is dynamic! Difficult to represent on paper
We (Instructors and students) are prone to errors and inaccuracies! Bad Timing Skipping or rearranging steps Big picture may not be clear
INTRODUCTION AND BACKGROUND
Motivation for animated visualization of computer science concepts Faithful representation Illustration of temporal nature Efficient display of repetitive computations Perceptually salient groups, structures, relationships, and causality
We can see how the program is running
SORTING OUT SORTING
SORTING OUT SORTING: EARLY WORK
Effective algorithm visualization must: Abstract or highlight only the essential aspects Carefully consider text and data representation and when to update them Suppress extraneous detail and enhance relevant features Choose appropriate timing and pacing
Baecker and his students spent seven years experimenting with animations of algorithms and programs
SORTING OUT SORTING
• The film focuses on nine sorting methods and their complexities:
• Insertion Sorts• Linear Insertion Sort• Binary Insertion Sort• Shellsort
• Exchange Sorts• Bubblesort• Shakesort• Quicksort
• A student who has watched the animation carefully could program some of the methods herself
• Selection Sorts• Straight Selection Sort• Tree Selection Sort• Heapsort
SORTING OUT SORTING
The film has been used with computer science students at various levels Generally shown in introductory CS courses at high school and university levels
As a motivational aid
Also shown in first or second courses on programming To introduce the concept of efficiency of different solutions to the same problem
SORTING OUT SORTING: PROBLEMS Early drafts lacked consistent visual conventions (confusing!) Color to denote ‘sorted’ or ‘still to consider’ Visual encoding strategies for elements
Timing is an issue Steps must be presented slowly enough for a narrator to give supplemental explanations
Once an algorithm is understood, later steps can be boring Some algorithms appear to slow down as they go along whereas others appear to speed up at the end
SORTING OUT SORTING: PROBLEMS Larger sets are problematic too New representations to compress desired info onto the screen are necessary
Consistency is required so as not to allow false interpretation of a cue
Being literal and going step-by-step aids initial understanding
BUT: have to go beyond this to add visual and dramatic interest Especially with more advanced material
“Totally literal and consistent presentations can be boring.”
SORTING OUT SORTING: SOLUTIONS The film is broken up into three groups of three
Algorithms in each group are shown in increasing order of efficiency (And therefore order of complexity of explanation)
Visual encoding strategies changed for each group Color for ‘yet to be considered’ and ‘sorted’ Color boundary for items being compared Items fade when they are not currently being considered by the algorithm Vertical bars, horizontal bars, or numbers to represent items
SORTING OUT SORTING: SOLUTIONS No pointers, no labels, no gimmicks Attributes of data and processes affecting them are shown by the aforementioned visual cues, motion, and accompanying narrative
Titles of each algorithm were scrambled, then ordered by each respective algorithm to show a preview of sorts
Each method is then demonstrated on a small data set Pace is sometimes increased after a few initial passes
SORTING OUT SORTING: SOLUTIONS Each group’s efficiency is then presented Line graphs show number of comparisons, number of data movements, and actual execution time
All three techniques race on the same data set
After all three groups, a grand race compares the efficiency across all nine algorithms 2500 data items Quicksort and Treesort: ~20 seconds Other n log(n) algorithms: ~40 seconds n^2 algorithms: … ~55 minutes
SORTING OUT SORTING: SOLUTIONS https://www.youtube.com/watch?v=SJwEwA5gOkM
9-way race 25:37
SORTING OUT SORTING: ANALYSIS Efficacy and influence of the 30 minute film were rated highly Interviews with students Informal, unpublished experiment
With no marketing, it sold more than 600 copies
Baecker received lots of praise and many letters “I am profoundly deaf... I was not able to understand ANY of the voice-over “I am profoundly deaf... I was not able
to understand ANY of the voice-over commentary on the film. I could hear someone talking; I could hear music, and beeps; but I could not understand WHAT was being said. Interestingly enough, this was not any particular disadvantage. I felt that I could understand most of the film... without hearing any of the commentary.” (Bev Biderman, 12 March 1982)commentary on the film. I could hear someone talking; I could hear music, and beeps; but I could not understand WHAT was being said. Interestingly enough, this was not any particular disadvantage. I felt that I could understand most of the film... without hearing any of the commentary.” (Bev Biderman, 12 March 1982)
Most importantly, it stimulated a significant amount of further work in algorithm analysis
SORTING OUT SORTING: ANALYSIS
Weaknesses of the film: ‘atrocious’ typography ‘mediocre’ color Sub-optimal timing (diverse audience) Heavy focus on efficiency, ignores best/worst case analyses Omits merge and distribution sorts
SORTING OUT SORTING: ANALYSIS
Lessons learned: Effective symbolism depends on size, scale, and context of items With careful illustration and timing, significant insight into algorithm behavior is possible
Control over motion dynamics must be powerful and flexible to communicate effectively
Timing is absolutely critical
DISCUSSION
Periodic surveys of instructor interest in Algorithm Visualization show: Over 90% indicate a strong positive view in favor of AV use Only about 10% indicate frequent use of AV in their courses 50-75% indicated occasional usage Most agree that AV can help students learn computer science
Why do you think this discrepancy exists?
Where do you stand on the usage of AV and similar visualization methods in the classroom? What roles should they play?
DISCUSSION
Roughly half of surveyed instructors’ problems with AV usage stem from locating suitable examples
The other half relate to issues integrating AVs into their courses and lectures
What can be done to combat these issues?
Do you have any anecdotal evidence or experiences to support usage of AVs?
DISCUSSION
Resources:
http://www.cs.usfca.edu/~galles/visualization/Algorithms.html
http://algoviz.org/avcatalog
http://people.cs.vt.edu/~shaffer/CS6604/Papers/AVpedagogypost.pdf
THANK YOU!
I appreciate your attention and involvement!