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
Copy file name to clipboardExpand all lines: v3/docs/project-ideas.md
+57-26Lines changed: 57 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ so that OPT visualizations (and the surrounding user interface) look good on dis
35
35
ranging from smartphones to tablets to laptops to giant desktop monitors.
36
36
37
37
38
-
# Richer input/output
38
+
# Frontend
39
39
40
40
## Rich user input widgets
41
41
@@ -55,7 +55,7 @@ Here are some examples of input widgets:
55
55
- A text box that represents a file on the filesystem. Imagine a web-based I/O simulator where there would be a text box simulating a file object, and then I/O calls such as open, readline, etc. would be intercepted and visualized as iterating (pointing) to the file object one line at a time, reading each line into a string, etc. Writing into a file can also be visualized in this way too. And seeking, overwriting, appending, etc.
56
56
57
57
58
-
# Custom data structure visualizations
58
+
##Custom data structure visualizations
59
59
60
60
Right now Online Python Tutor can render only basic Python data structures.
61
61
@@ -98,6 +98,36 @@ The ultimate goal here is to completely replace one-off custom algorithm visuali
98
98
and ad-hoc PowerPoint slide deck animations of CS concepts.
99
99
100
100
101
+
## Annotations for simplifying visualizations
102
+
103
+
Right now OPT visualizes "everything" about program execution. However, that can easily lead to visual overload.
104
+
Let's think about implementing annotations to selectively show/hide different parts of execution, so that instructors
105
+
and students can hone in on what they find interesting. Examples:
106
+
107
+
- annotate functions to trace/skip
108
+
- annotate data structures (or parts) to show/hide
109
+
- selectively expand or collapse data structure visualizations, which is useful for giant structures
110
+
- line-based breakpoints (currently implemented as a hack by puttin `# break` at the end of a line)
111
+
- conditional breakpoints
112
+
113
+
Implementing annotations as ordinary code comments (rather than using a specialized UI) is elegant
114
+
because the instructor's code examples are self-contained in plain text and easily archivable outside of OPT.
115
+
116
+
117
+
## Optimize display of object-oriented programs
118
+
119
+
This is a good project for an object-oriented programming enthusiast.
120
+
121
+
Right now OPT naively visualizes all the steps that the Python interpreter takes when executing an
122
+
object-oriented program, which leads to all sorts of extraneous variables, frames, and pointers
123
+
lying around.
124
+
125
+
<ahref="http://pythontutor.com/visualize.html#code=%23+Inheritance+-+object-oriented+programming+intro%0A%23+Adapted+from+MIT+6.01+course+notes+(Section+3.5)%0A%23+http%3A//mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf%0A%0Aclass+Staff601%3A%0A++++course+%3D+'6.01'%0A++++building+%3D+34%0A++++room+%3D+501%0A%0A++++def+giveRaise(self,+percentage)%3A%0A++++++++self.salary+%3D+self.salary+%2B+self.salary+*+percentage%0A%0Aclass+Prof601(Staff601)%3A%0A++++salary+%3D+100000%0A%0A++++def+__init__(self,+name,+age)%3A%0A++++++++self.name+%3D+name%0A++++++++self.giveRaise((age+-+18)+*+0.03)%0A%0A++++def+salutation(self)%3A%0A++++++++return+self.role+%2B+'+'+%2B+self.name%0A%0Apat+%3D+Prof601('Pat',+60)&mode=display&cumulative=false&py=2&curInstr=16">Click here for an example.</a>
126
+
127
+
This project involves cleaning up the execution trace so that object-oriented programs look
128
+
sensible when visualized.
129
+
130
+
101
131
# Backend
102
132
103
133
## Offline mode for use as a production debugger
@@ -130,24 +160,10 @@ Ok sorry that was mostly me thinking out loud.
130
160
131
161
}
132
162
133
-
Ha, I guess you can call this "Offline Python Tutor"!
163
+
Ha, I guess you can call this **"Offline Python Tutor"**!
134
164
135
165
136
-
## Optimize display of object-oriented programs (medium)
137
-
138
-
This is a good project for an object-oriented programming enthusiast.
139
-
140
-
Right now OPT naively visualizes all the steps that the Python interpreter takes when executing an
141
-
object-oriented program, which leads to all sorts of extraneous variables, frames, and pointers
142
-
lying around.
143
-
144
-
<ahref="http://pythontutor.com/visualize.html#code=%23+Inheritance+-+object-oriented+programming+intro%0A%23+Adapted+from+MIT+6.01+course+notes+(Section+3.5)%0A%23+http%3A//mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf%0A%0Aclass+Staff601%3A%0A++++course+%3D+'6.01'%0A++++building+%3D+34%0A++++room+%3D+501%0A%0A++++def+giveRaise(self,+percentage)%3A%0A++++++++self.salary+%3D+self.salary+%2B+self.salary+*+percentage%0A%0Aclass+Prof601(Staff601)%3A%0A++++salary+%3D+100000%0A%0A++++def+__init__(self,+name,+age)%3A%0A++++++++self.name+%3D+name%0A++++++++self.giveRaise((age+-+18)+*+0.03)%0A%0A++++def+salutation(self)%3A%0A++++++++return+self.role+%2B+'+'+%2B+self.name%0A%0Apat+%3D+Prof601('Pat',+60)&mode=display&cumulative=false&py=2&curInstr=16">Click here for an example.</a>
145
-
146
-
This project involves cleaning up the execution trace so that object-oriented programs look
147
-
sensible when visualized.
148
-
149
-
150
-
## Add better Unicode support (medium)
166
+
## Add better Unicode support
151
167
152
168
This project is a great fit for someone familiar with coding in non-English languages.
153
169
@@ -184,30 +200,43 @@ s = u'—'
184
200
(Note that Unicode support in Python 2 and 3 involve different subtleties.)
185
201
186
202
187
-
## Create an OPT backend for a different programming language (hard)
203
+
## Visualizing different programming languages (especially JavaScript!)
188
204
189
205
This project is great for someone who likes to hack on language implementations and runtimes.
190
206
191
207
The OPT frontend can visualize programs written in any mainstream language, not just Python.
192
208
This project involves creating a backend for another language (e.g., Ruby, Java, JavaScript, C, C++, Scheme).
193
-
All the backend needs to do is to generate an execution trace in the following format ...
209
+
All the backend needs to do is to generate an execution trace in the following format:
... and the frontend should be able to visualize it!
213
+
And the OPT frontend should be able to visualize it!
214
+
215
+
In particular, I think a **JavaScript backend** would be amazing.
216
+
By hacking the [narcissus](https://github.com/mozilla/narcissus) meta-circular JavaScript interpreter,
217
+
you should be able to implement a JavaScript visualizer purely in the browser. You get the benefits of
218
+
low latency, offline access, and no security concerns that plague traditional server-side apps. How cool is that?!?
198
219
199
-
For instance, the [Chicory Java trace generator for Daikon](http://groups.csail.mit.edu/pag/daikon/download/doc/daikon_manual_html/daikon_7.html#SEC69)
220
+
Check out backends that other people have already written:
221
+
222
+
-[Online Java Tutor](http://cscircles.cemc.uwaterloo.ca/java_visualize/) by David Pritchard
223
+
-[Online Ruby Tutor](http://www.onlinerubytutor.com/) by Daniel Stutzman
224
+
-[Blockly + OPT](http://epleweb.appspot.com/) by Pier Giuliano Nioi
225
+
226
+
Other misc. implementation notes:
227
+
228
+
- The [Chicory Java trace generator for Daikon](http://groups.csail.mit.edu/pag/daikon/download/doc/daikon_manual_html/daikon_7.html#SEC69)
200
229
might be a good basis for writing a Java backend for OPT. Or take a look at [jdb](http://docs.oracle.com/javase/1.3/docs/tooldocs/solaris/jdb.html), which
201
230
should be similar to how Online Python Tutor uses Python's pdb module to generate traces.
202
231
203
-
Also, my
204
-
[master's thesis](http://pgbovine.net/projects/pubs/guo-mixedlevel-mengthesis.pdf) from 2006
232
+
- My [master's thesis](http://pgbovine.net/projects/pubs/guo-mixedlevel-mengthesis.pdf) from 2006
205
233
describes one possible technique for building a C-language backend based upon the [Valgrind](http://www.valgrind.org)
206
234
tool. More importantly, it describes the difficulties involved in creating a robust execution
207
-
trace generator for C and C++. It should be much easier to build a backend for a memory- and type-safe language, though :)
235
+
trace generator for C and C++.
236
+
It should be much easier to build a backend for a memory- and type-safe language, though :)
208
237
209
238
210
-
## Migrate OPT backend to Skulpt (very hard but super cool!)
239
+
## Skulpt (Python-in-JavaScript) backend
211
240
212
241
This project is appropriate for someone with advanced knowledge of hacking a Python interpreter
213
242
who is willing to make a substantive time commitment.
@@ -241,3 +270,5 @@ Dec 2012: Brython -- http://www.brython.info/index_en.html -- might also be a co
241
270
242
271
May 2013: The main caveat with re-implementing for one of these alternative Python implementations is that they don't support the full ("official") Python language.
243
272
Thus, users might be frustrated that code they type into this tutor doesn't run exactly like code they type into the official Python interpreter.
273
+
That said, though, a Skulpt implementation would still be useful, as long as users understand its limitations and caveats, and that it doesn't support the full Python language in all of its glory (or its weird edge-case behaviors).
0 commit comments