You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f86f624
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: v3/docs/project-ideas.md
+74-12Lines changed: 74 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,17 +64,37 @@ algorithms involving more sophisticated data structures such as binary trees and
64
64
The goal of this project is to create a set of effective custom renderers for data structures
65
65
such as:
66
66
67
-
- trees,
68
-
- graphs,
69
-
- numerical matrices,
70
-
- and even simple 2D graphical worlds (e.g., for Pac-Man or Conway’s Game of Life).
67
+
- trees
68
+
- graphs
69
+
- numerical matrices
70
+
- simple 2D graphical worlds (e.g., for Pac-Man or Conway’s Game of Life)
71
+
- rendering lists of numbers as bar/line graphs, charts, and other quantitative data visualizations (e.g., using Google Charts API)
72
+
- file objects
73
+
- DSL components such as logic gates for a logic simulator written in Python, or proof trees for formal logic courses
71
74
72
75
These renderers will make Online Python Tutor useful in a far larger variety of CS courses and online textbooks
73
76
beyond CS0/CS1 sorts of intro classes.
74
77
75
78
One ultimate goal is to make OPT capable of visualizing classic AI and algorithm textbook algorithms
76
79
that otherwise would need to be tediously built as one-off special-case visualizations.
77
80
81
+
From an email excerpt in May 2013: {
82
+
I recently added a feature to Online Python Tutor (OPT) that enables user programs to output HTML/CSS/JS, in addition to printing to stdout. Thus, if a program calls html_output(" ... "), when OPT steps over that line, it will render the HTML string in a div. This makes it possible to generate a wide array of visualizations in pure Python (by simply constructing strings that represent legal HTML/CSS/JS).
83
+
84
+
For the file I/O example, I can imagine creating a special File class that implements "file-like" stream I/O methods. Then the user program might look like:
85
+
86
+
---
87
+
import VisualFile
88
+
f = VisualFile(<stringcontentsofthefile>)
89
+
90
+
for line in open(f):
91
+
<parseline>
92
+
---
93
+
94
+
The class definition of VisualFile includes the proper HTML-generation code to render a pretty HTML representation of the file's contents. And when methods iterate over the file, it can render an HTML representation with certain lines or characters highlighted to represent, say, the current file pointer position, etc.
95
+
}
96
+
97
+
78
98
There are (at least) two main ways to implement this feature:
79
99
80
100
- Add custom data types to the trace and have the frontend render them specially, using JS visualization libraries such as d3.
@@ -123,21 +143,26 @@ lying around.
123
143
Think about how annotations can "clean up" such a big and hairy visualization.
124
144
125
145
126
-
### Authoring environment
146
+
### Web-based authoring environment
147
+
148
+
With a proper Web-based authoring environment, teachers and students can use
149
+
Online Python Tutor visualizations as the basis for annotated examples,
150
+
programming exercises, and quizzes.
151
+
152
+
As a start, I've implemented a prototype of "annotation bubbles" for fine-grained annotation of visualization elements:
127
153
128
-
With a proper authoring environment,
129
-
Online Python Tutor visualizations could become a basis for annotated examples, programming exercises, and quizzes.
154
+

130
155
131
156
132
157
**Annotated code visualizations**:
133
158
134
-
- Teachers to use as a place to put their code examples and mini-lessons (so that they’re persistent, rather than sending out a bunch of gross URLs)
135
-
- Lesson text can be fine-grained -- e.g., specific text to accompany each execution point, or annotations atop individual objects.
136
-
- I've already implemented a prototype of "annotation speech bubbles" to annotate individual visualization elements.
137
-
- Think about what asides or remarks would a teacher/mentor SAY OUT LOUD when stepping through code with a student/mentee. Those are probably the kinds of commentary that you'd want to put inside of visualizations.
159
+
- Teachers could use it as a place to put their code examples and mini-lessons (so that they’re persistent, rather than sending out a bunch of gross URLs)
160
+
- Lesson text can be fine-grained -- e.g., specific text to accompany each execution point, or annotations atop individual objects.
161
+
- see the above screenshot for "annotation bubbles" prototype to label individual visualization elements
162
+
- Think about what asides or remarks would a teacher/mentor SAY OUT LOUD when stepping through code with a student/mentee. Those are probably the kinds of commentary that you'd want to put inside of visualizations.
138
163
- Students could use it as a Stackoverflow-like forum for asking questions
139
164
- Potentially powerful use case in MOOCs where students can directly annotate visualizations while debugging and then fire off a question to a discussion forum (with all required context). Again, OPT will be embedded within a larger MOOC courseware environment and be a segue into discussion forums.
140
-
- With a lightweight authoring environment, OPT can be used for embedding read-write visualizations. When a student is viewing code visualizations embedded within a textbook or lesson, they can mark annotations for parts they don’t understand and then send off the link to the course staff or discussion forum. So in essence, they’re interacting with the visualization rather than just passively consuming it.
165
+
- With a lightweight authoring environment, OPT can be used for embedding read-write visualizations. When a student is viewing code visualizations embedded within a textbook or lesson, they can mark annotations for parts they don’t understand and then send off the link to the course staff or discussion forum. So in essence, they’re interacting with the visualization rather than just passively consuming it.
141
166
142
167
143
168
**Exercises/quizzes**: Since we have rich visualizations and interactivity at our disposal,
@@ -148,8 +173,45 @@ and the user would need to fill in those slots with the appropriate values. (The
148
173
not-yet-documented prototype of these sorts of pop-up questions, done by Brad Miller.)
149
174
150
175
176
+
### Visualizing orders of growth
177
+
178
+
Think about how to convey orders of growth of algorithms across data sets of varying sizes.
179
+
180
+
Notes from Peter N.: {
181
+
Peter suggested augmenting special data structure classes with callback hooks to the visualizer (like __str__ on steroids). This allows the visualizer to gracefully skip steps of the yucky internals of a data structure while just stepping through the significant parts. You can imagine instrumenting an Array class and visualizing compares, swaps, etc. for sorting algorithms.
182
+
183
+
"Third, it would also be great to have a plot API, to plot the runtimes (or some other stat) as a function of input size N."
184
+
185
+
"Fourth, while I have seen other algorithm systems where they annotate the code (by putting in annotations that say @step or something), I think we can get away without it. For example, if the problem is sorting a list of integers, don't annotate the algorithm: just pass it an input that consists not of a list of ints, but rather an annotaed list of annotated ints. An annotated lists increments a counter for every __getitem__ and __setitem__, and an annotated int increments a counter for every __lt__ and the like. It won't survive malicious attacks, but it will work for all but the actively uncooperative users."
186
+
187
+
We also talked about visualizing orders of growth of code, such as loops, nested loops, etc. by visualizing how many times things execute and then how that changes as your input size changes.
188
+
}
189
+
190
+
151
191
## Backend
152
192
193
+
### Support multiple concurrent viewers
194
+
195
+
My main high-level vision for where to take the shared editing is the following:
196
+
197
+
1. The instructor tells students to join a shared session.
198
+
2. The instructor starts "driving" and typing code in the shared session. students watch along.
199
+
3. At any time, a student can click a "detach" button and detach his/her session from the teacher. Then the session acts just like regular Online Python Tutor.
200
+
4. At any time, a student can "reattach" to the shared session and follow the instructor again.
201
+
202
+
The basic idea here is that students can follow along with an instructor but then "detach" at anytime to try out their own variations and experiments without interfering with other people's sessions.
203
+
204
+
Here's another snippet on this idea:
205
+
206
+
Collaborative visualizations: Adding real-time concurrent editing to these visualizations enables students to work together and tutor one another while physically separated. A shared workspace can also be useful during both physical and virtual lectures: As the instructor is lecturing using code visualizations, students can follow along by viewing those same running examples on their laptops. At any point when curious or confused, students can instantly diverge from the live example and try out their own variants
207
+
on-the-fly in private; they can then sync back to the "live feed" at any time. Students can also text
208
+
chat with one another about the lecture, all within the context of the live lecture materials. If students
209
+
opt-in to allowing the instructor to access such interaction data, then that could "close the loop" and
210
+
help the instructor improve future lectures. For instance, if 80% of students are silently diverging from
211
+
the live example at a certain point in lecture, then perhaps that part requires further clarification.
212
+
213
+
A related point/question is: what happens if two people try to simultaneously edit? i assume that they clobber each other's changes, right? in that case, it might be good to designate only ONE person who can edit, and everyone else just watches. or else a mischievous student can just delete everyone's code. of course, you can also have another "free-for-all" mode where everyone can edit.
214
+
153
215
154
216
### Visualizing different programming languages (especially JavaScript!)
0 commit comments