PyDev of the Week: Philip Guo

This week we welcome Philip Guo (@pgbovine) as our PyDev of the Week! Philip is the creator of the popular Python Tutor website and a professor at UC San Diego in the cognitive science and computer science department. Let's take some time to get to know Philip!

Can you tell us a little about yourself (hobbies, education, etc):

I am an assistant professor of cognitive science and computer science at UC San Diego. My research and teaching revolve around the topic of how to greatly expand the population of people around the world who can learn programming skills. There's a lot of great people working on training the next generation of software developers, but I'm also interested in how we can apply programming to many other fields including the physical sciences, social sciences, design, arts, and humanities. Outside of my normal work, I used to write a lot of articles on my website but lately I've been trying to stay off the computer in my off-time, so I've turned to recording vlogs, podcasts, and other audio/video content that don't require me to be glued to the computer.

Why did you start using Python?

Wow, that made me think way back ... I first started using Python around 2004 (I believe it was Python 2.2 or 2.4 back then) to write small programs to organize my personal photo collection and create static photo galleries for my website. We didn't have a term for this back then, but now I think people call it a "static site generator" -- the idea being that you would write scripts offline to pre-process and organize your content, then generate the appropriate HTML pages. Those HTML pages can then be uploaded (via old-school FTP) to a web server and then visible on the web. The nice thing about static site generators (especially back in those days) was that you could host your website anywhere since it was just a bunch of HTML and image files; there was no need for the server to support any kind of scripting. Python made me fall in love with programming because for the first time I could write code to do something tangible and immediately useful to me. Before that, I saw code mostly as either an academic subject that I learned in classes or a tool that I used for jobs.

What other programming languages do you know and which is your favorite?

Besides Python, I probably know JavaScript the next best since most of my day-to-day programming work is building web apps, which requires JavaScript for the frontend. I've been doing JavaScript for longer than Python, starting around 1997 or so, but that was *really* simple copy-and-paste from books sort of stuff. I didn't actually understand what was going on with the goofy JavaScript animation code that I copied into my very first websites over 20 years ago (wow, time flies!). I've been steadily tracking the evolution of the JavaScript ecosystem throughout the past 20 years, and am equal parts inspired and horrified by it.

I also know C pretty well in theory, but in practice I haven't had to use it much for the past decade. I used to write a ton of low-level source and binary code manipulation tools for my software analysis research back in the day, so I had to wrestle with the innards of the C and Linux world more than I'd want to remember. I think it's immensely important for people to at least have a decent understanding of C and its compiler toolchain ecosystem (whether on Windows or UNIX-like systems) since many higher-level programming languages are implemented in C.

I'll say Python is my favorite since I'm doing this interview 🙂 But really I try not to get too dogmatic about particular programming languages. In terms of what I'd turn to for most tasks, I'd pick up Python just because I know it the best.

This article is a retrospective of my history of learning programming: http://pgbovine.net/how-i-learned-programming.htm

What projects are you working on now?

Now that I manage a research group of anywhere from 4 to 6 graduate students at a time, the true answer to this question is: the union of whatever my students are working on, plus whatever my external collaborators work on. I'm mostly herding cats nowadays.

If I had to sum up what we collectively work on, I'd say it's: studying and building scalable ways to help people learn computer programming and data science. I know that's an unsatisfying answer, so check out my publications page for details. It shows the outputs of all of our past projects, along with supplemental resources and various summaries: http://pgbovine.net/publications.htm

In addition to advising on research projects, I try hard to carve out time to continue working on Python Tutor, which is probably how most people in the Python community know about me. Very briefly, it's a web-based tool that helps people overcome a fundamental barrier to learning programming: understanding what happens as the computer runs each line of code. Using Python Tutor, you can write code in your web browser, see it visualized step by step, and get live help from volunteers. So far, over 3.5 million people in over 180 countries have used Python Tutor to visualize over 50 million pieces of code, often as a supplement to textbooks, lectures, and online tutorials. Finally, despite its Pythonic name, it actually supports five other popular languages: Java, JavaScript, Ruby, C, and C++.

Which Python libraries are your favorite (core or 3rd party)?

I haven't thought too much about this. A meta-answer to this question is to just install Anaconda, which makes tons of popular 3rd-party libraries available on your machine without going through the enormous pain of installing dependencies (especially on Windows). Another meta-answer is that I should just parse all of my old Python code (using the ast module!), then make a charts of all of the modules I've imported, and see how frequently I've used each one.

Thinking about it a bit more, maybe I'd say the bdb module from the standard library.

I wouldn't say it's my "favorite" as in "wow I love bdb so much!" but rather it's an essential part of Python Tutor since that's what enables me to hook into every step of code execution to visualize its run-time state. Without bdb, there would be no Python Tutor. So I suppose it's my favorite since it enabled me to create my most popular project to date. So yeah, long live bdb!

Is there anything else you’d like to say?

Stepping away from the computer can increase your IQ by 50 points (scientifically proven ... ok, maybe not). Especially when writing code, it's tempting to just keep hammering away at a bug or feature stubbornly and twiddling bits because you think that the very next run will be the correct one, and then you can dig yourself deeper and deeper into a hole of fatigue. Seriously, just step away from the computer for a while; take a walk, go get some exercise, watch silly YouTube videos on your phone, go out to run some errands. And I guarantee that when you come back refreshed, you'll suddenly see the solution to your coding problem so clearly that you couldn't believe you didn't see it before.

Also, on a related note, as I mentioned earlier, I've been trying to minimize my computer time while I'm not working. I've been a lot happier and more relaxed when I associate my computer purely with work, and when I'm not working, I don't go near it. (I still have my phone where I can browse the web, watch YouTube, etc., so it's not like I'm totally disconnected.)

Copyright © 2024 Mouse Vs Python | Powered by Pythonlibrary