Decorators make code more readable. When learning how decorators work, it’s easy to get confused. When teaching decorators, students often ask “but how does it work” and “why does it work”. “Magic, it just does” and “follow the pattern of the example” could be reasonable though less than satisfying responses.
Online Python Tutor
Learning to use decorators can be frustrating until the learner understands how decorators work. To build mastery, students want to visualize what the computer is doing when using a decorator. Fortunately, Phillip Guo has developed Online Python Tutor to improve the student’s learning experience.
Online Python Tutor lets users enter code and interactively see what is happening when the code executes. It breaks things down to a step by step visual of how data moves behind the scenes when a program executes.
Sharing and embedding visualizations
Two great features of Online Python Tutor are the user can share live visualizations of the code and can embed the visualizations in any web page. The emphasis on sharing and collaboration helps teachers to easily communicate concepts to their students.
Let’s look at a decorator example
To use the interactive demo, simply click on the ‘next’ and ‘back’ buttons to move through the code step by step.
Interactive decorator example
Phillip Guo’s research publication
For the those that are curious, Phillip Guo’s research paper presents why and how Online Python Tutor improves learning. Thank you for this wonderful program!