Skip to content

Commit 0afb3e6

Browse files
committed
Update project-ideas.md
1 parent 8662fdb commit 0afb3e6

1 file changed

Lines changed: 57 additions & 26 deletions

File tree

v3/docs/project-ideas.md

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ so that OPT visualizations (and the surrounding user interface) look good on dis
3535
ranging from smartphones to tablets to laptops to giant desktop monitors.
3636

3737

38-
# Richer input/output
38+
# Frontend
3939

4040
## Rich user input widgets
4141

@@ -55,7 +55,7 @@ Here are some examples of input widgets:
5555
- 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.
5656

5757

58-
# Custom data structure visualizations
58+
## Custom data structure visualizations
5959

6060
Right now Online Python Tutor can render only basic Python data structures.
6161

@@ -98,6 +98,36 @@ The ultimate goal here is to completely replace one-off custom algorithm visuali
9898
and ad-hoc PowerPoint slide deck animations of CS concepts.
9999

100100

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+
<a href="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+
101131
# Backend
102132

103133
## Offline mode for use as a production debugger
@@ -130,24 +160,10 @@ Ok sorry that was mostly me thinking out loud.
130160

131161
}
132162

133-
Ha, I guess you can call this "Offline Python Tutor"!
163+
Ha, I guess you can call this **"Offline Python Tutor"**!
134164

135165

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-
<a href="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
151167

152168
This project is a great fit for someone familiar with coding in non-English languages.
153169

@@ -184,30 +200,43 @@ s = u'—'
184200
(Note that Unicode support in Python 2 and 3 involve different subtleties.)
185201

186202

187-
## Create an OPT backend for a different programming language (hard)
203+
## Visualizing different programming languages (especially JavaScript!)
188204

189205
This project is great for someone who likes to hack on language implementations and runtimes.
190206

191207
The OPT frontend can visualize programs written in any mainstream language, not just Python.
192208
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:
194210

195211
https://github.com/pgbovine/OnlinePythonTutor/blob/master/v3/docs/opt-trace-format.md
196212

197-
... 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?!?
198219

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)
200229
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
201230
should be similar to how Online Python Tutor uses Python's pdb module to generate traces.
202231

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
205233
describes one possible technique for building a C-language backend based upon the [Valgrind](http://www.valgrind.org)
206234
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 :)
208237

209238

210-
## Migrate OPT backend to Skulpt (very hard but super cool!)
239+
## Skulpt (Python-in-JavaScript) backend
211240

212241
This project is appropriate for someone with advanced knowledge of hacking a Python interpreter
213242
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
241270

242271
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.
243272
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).
274+

0 commit comments

Comments
 (0)