|
| 1 | +# Project Ideas |
| 2 | + |
| 3 | +This document provides an overview of some project ideas for extending |
| 4 | +Online Python Tutor (thereafter abbreviated as OPT). View it online at: |
| 5 | + |
| 6 | +https://github.com/pgbovine/OnlinePythonTutor/blob/master/v3/docs/project-ideas.md |
| 7 | + |
| 8 | +These projects are listed roughly in order of difficulty. |
| 9 | + |
| 10 | +Email philip@pgbovine.net if you're interested in working on anything here, or if you have other |
| 11 | +project ideas. |
| 12 | + |
| 13 | + |
| 14 | +## Enable beautiful print-outs of OPT visualizations (easy) |
| 15 | + |
| 16 | +A lot of instructors want to print out their OPT visualizations to make handouts or lecture notes |
| 17 | +for students. |
| 18 | +However, the default CSS stylesheet is optimized for on-screen viewing and not for printing, |
| 19 | +so when you try to print the diagrams, they look ugly and unreadable. |
| 20 | + |
| 21 | +The project involves creating a custom CSS optimized for printing, especially on black-and-white printers. |
| 22 | +Here is an example how-to guide to get started creating a CSS print style sheet ... |
| 23 | +http://coding.smashingmagazine.com/2011/11/24/how-to-set-up-a-print-style-sheet/ |
| 24 | + |
| 25 | + |
| 26 | +## Add better Unicode support (medium) |
| 27 | + |
| 28 | +This project is a great fit for someone familiar with coding in non-English languages. |
| 29 | + |
| 30 | +Right now, OPT has poor-to-nonexistent Unicode support, so adding it is important for making it friendlier to |
| 31 | +non-English audiences. |
| 32 | + |
| 33 | +Here is one bug report that inspired this project idea: |
| 34 | + |
| 35 | +""" |
| 36 | +I’m having some fun with your nifty Python visualiser. |
| 37 | +While trying too see what happens in Unicode strings are processed, |
| 38 | +I encountered some odd little quirks such as a unicode character |
| 39 | +being replace with a string representation of a Unicode code point |
| 40 | +number in denary. |
| 41 | + |
| 42 | + |
| 43 | +<a href="http://www.pythontutor.com/visualize.html#code=s+%3D+unicode(0x2015)%0Aa+%3D+'Myer'+%2B+s+%2B+'Briggs'%0Ax+%3D+a.index(s)%0Al+%3D+a%5B%3Ax%5D%0Ar+%3D+a%5Bx+%2B+len(s)%3A%5D%0Aprint+l%0Aprint+r%0Aprint+'%22'+%2B+a+%2B+'%22+is+'+%2B+str(len(a))+%2B+'+characters+long.'%0Afor+i,+z+in+unumerate(a)%3A%0A++print+'a%5B'+%2B+str(i)+%2B+'%5D+%3D+'+%2B+str(z)&mode=display&cumulative=false&py=2&curInstr=8">click to visualize code snippet</a> |
| 44 | + |
| 45 | +Changing the first line to |
| 46 | + |
| 47 | +```python |
| 48 | +s = u'\u2015' |
| 49 | +``` |
| 50 | + |
| 51 | +Causes an “unknown error” to be reported, as does the insertion of unicode characters like “—” (em dash) in string literals. |
| 52 | + |
| 53 | +The following code causes the interpreter to hang. |
| 54 | +```python |
| 55 | +# -*- coding: utf-8 -*- |
| 56 | +s = u'—' |
| 57 | +``` |
| 58 | +""" |
| 59 | + |
| 60 | +(Note that Unicode support in Python 2 and 3 involve different subtleties.) |
| 61 | + |
| 62 | + |
| 63 | +## Create an OPT backend for a different programming language (hard) |
| 64 | + |
| 65 | +This project is great for someone who likes to hack on language implementations and runtimes. |
| 66 | + |
| 67 | +The OPT frontend can visualize programs written in any mainstream language, not just Python. |
| 68 | +This project involves creating a backend for another language (e.g., Ruby, Java, JavaScript, C++, Scheme, |
| 69 | +whatever you want!). All the backend needs to do is to generate an execution trace |
| 70 | +in the following format ... |
| 71 | + |
| 72 | +https://github.com/pgbovine/OnlinePythonTutor/blob/master/v3/docs/opt-trace-format.md |
| 73 | + |
| 74 | +... and the frontend should be able to visualize it! |
| 75 | + |
| 76 | + |
| 77 | +## Migrate OPT backend to Skulpt (very hard but super cool!) |
| 78 | + |
| 79 | +This project is appropriate for someone with advanced knowledge of hacking a Python interpreter. |
| 80 | + |
| 81 | +Right now the OPT backend runs Python code on the server, but it would be super-cool to create a "backend" |
| 82 | +that runs entirely in the browser. Modifying Skulpt -- http://www.skulpt.org/ -- is the leading contender here, |
| 83 | +since I am in touch with its main developers. |
| 84 | + |
| 85 | +Main Advantages: |
| 86 | + - Enables fine-grained tracing of expression and sub-expression evaluation, which has clear pedagogical benefits; right now OPT can only single-step over one line at a time since it relies on the Python bdb debugger. |
| 87 | + - Enables an interactive REPL that incrementally takes in user inputs rather than just executing batch programs; this can lead to better interactivity and responsiveness. |
| 88 | + - Supports on-demand evaluation and in-memory storage of (relatively) large data structures such as a 100,000-element dictionary for a spell checker program; right now OPT must send that giant dictionary in a trace (encoded in an inefficient format). |
| 89 | + - Works in "offline mode" for students in regions without reliable Internet access |
| 90 | + |
| 91 | + |
| 92 | +Tips & Tricks: |
| 93 | + - From Brad Miller: http://blog.bonelakesoftware.com/2011/03/adding-module-to-skulpt.html and http://blog.bonelakesoftware.com/2011/02/python-in-your-browser-in-javascript.html |
| 94 | + - From Scott Graham, when I asked him whether Skulpt implements Python 2 or 3: “Mostly 2-ish. Some object hierarchy things take after 3's simplified semantics.” |
0 commit comments