Posts tagged ‘Python’

Stanford CS department updates introductory courses: Java is Gone

Stanford has decided to move away from Java in their intro courses. Surprisingly, they have decided to move to JavaScript.  Philip Guo showed that most top CS departments are moving to Python.  The Stanford Daily article linked below doesn’t address any other languages considered.

The SIGCSE-Members list recently polled all of their members to talk about what they’re currently teaching.  The final spreadsheet of results is here.  Python appears 60 times, C++ 54 times, Java 84 times, and JavaScript 28 times.  I was surprised to see how common C++ is, and if Java is dying (or “showing its age,” as Eric Roberts is quoted below), it’s going out as the reigning champ.

When Java came out in 1995, the computer science faculty was excited to transition to the new language. Roberts wrote the textbooks, worked with other faculty members to restructure the course and assignments and introduced Java at Stanford in 2002. “Java had stabilized,” Roberts said. “It was clear that many universities were going in that direction. It’s 2017 now, and Java is showing its age.” According to Roberts, Java was intended early on as “the language of the Internet”. But now, more than a decade after the transition to Java, Javascript has taken its place as a web language.

Source: CS department updates introductory courses | Stanford Daily

ADDENDUM: As you see from Nick Parlante’s comment below, the JavaScript version is only an experiment.  From people I’ve talked to at Stanford, and from how I read the article quoted above (“more than a decade after the transition to Java, Javascript has taken its place”), I believe that Stanford is ending Java in CS106.  I’m leaving the title as-is for now. I’ve offered to Marty Stepp that if CS106 is still predominantly Java in one year, I will post a new blog post admitting that I was wrong.  Someone remind me in April 2018, please.

April 21, 2017 at 7:09 am 34 comments

Where are the Python 3 Libraries for Media Computation

My Blog@CACM post for this month is on JES, the Jython Environment for Students, which at 14 years old and over 10,000 downloads, is probably one of the oldest, most used, and (by some definition) most successful pedagogical Python IDE’s.

The SIGCSE Members list recently had a discussion about moving from Python 2 to Python 3. Here’s a description of differences. Some writers asked about MediaComp. With respect to the Media Computation libraries, one wrote:

I’m sad about this one, because we use and like this textbook, but I think it’s time to move to Python 3.  Is there a compatible library providing the API used in the text?

Short answer: No. There are no compatible Media Computation libraries for CPython 2 or 3.

We keep trying. The latest attempt to build Media Computation libraries in CPython is here: https://github.com/sportsracer48/mediapy. It doesn’t work on all platforms yet, e.g., I can’t get it to load on MacOS.

We have yet to find a set of libraries in Python that work cross-platform identically for sample-level manipulations of sounds. For example, PyGame’s mixer object doesn’t work exactly the same on all platforms (e.g., sampling rates aren’t handled the same on all platforms, so the same code plays different speed output on different platforms). I can do pixel-level manipulations using PIL. We have not yet tried to find libraries from frame manipulations of video (as individual images). I have just downloaded the relevant libraries for Python 3 and plan to explore in the future, but since we can’t make it work yet in Python 2 (which has more mature libraries), I doubt it will work in Python 3.

I complained about this problem in my blog in 2011 (see post here). The situation is better in other languages, but not yet in Python.

  • I have been building Media Computation examples in GP, a blocks-based language (see post here).
  • Jeff Gray’s group at U. Alabama has built Blockly-like languages Pixly and Tunely for pixel and sample level manipulations.
  • Cynthia Lee at Stanford has been doing Media Computation in her classes in MATLAB and in C++
  • The Calico project supports Media Computation in IronPython (based on Python 3) and many other languages, because it builds on .NET/MONO which has good multimedia support.
  • We’re able to more and more in JavaScript-based Python implementations (like Pythy and Runestone), because JavaScript has excellent cross-platform multimedia support.

When we did the 4th edition of our Python Media Computation textbook, I looked into what we’d have to change in the book to move to Python 3. There really wasn’t much. We would have to introduce print as a function. We do very little integer division, so we’d have to explain that. The focus in our course (non-technical majors, first course) is at a higher level than the differences between Python 2 and 3. I am confident that, at the end of our course, the majority of our students would understand the differences between Python 2 and 3. As we move more to browser-based IDE’s, I can support either Python 2 or 3 syntax and semantics. Preparing students for industry jobs using exactly CPython 3 is simply not a priority in our course.

August 19, 2016 at 7:46 am Leave a comment

Do blocks equal “making” and text equal “coding”? Doing MediaComp in Blocks-Based Languages

Interesting perspective from a blogger in the Scratch community, liked below.  I do frequently hear the pattern described in the post quoted below.  “I’ve started by daughter/niece/local-school on Scratch, and now I want to know how to move them into something ‘real’ (e.g., text).”  I typically point them to amazing things that can be done in Scratch (like Alex Ruthmann’s beautiful livecoding of music in Scratch).

I recently got a chance to play with GP, a new programming language from John Maloney (of Scratch fame), where all blocks and texts are isomorphic.  There’s a slider that lets you switch from one to the other.  Even the debugger and class browser show up with tiles.  Where does that play out in this debate?  GP is the first blocks-based language I’ve used with the right primitives to do MediaComp, so I built one of my examples in it.  Took me about three times as much time to write and four times as much space (in screen real estate) as in Python (even with John looking over my shoulder guiding me).  Maybe that’s not a bad thing — maybe that encourages a different style of use.  Next time I try something like that, I’m far more likely to think about building my own blocks and using more abstraction to save on dragging-and-fitting effort.

I’ve been a part of the Scratch community for about 8 years now (yes, really). During this time, I’ve noticed a pattern that seems to apply to a lot of people:

join Scratch => create projects => discover text-based programming => quit Scratch because of “real programming”

Note the scare quotes around “real programming”. Generally, a “real” programming language is text-based (C, Python, etc.) and apparently qualifies as real because it’s used by well-known developers for something.

Obviously I disagree with disqualifying Scratch as a real programming language.

via Making vs Coding | byte.

July 8, 2015 at 7:14 am 23 comments

JES 5.02 Now Released, and Media Computation 4th Edition Slides Available

JES 5.02 is now released at https://github.com/gatech-csl/jes/releases/tag/5.020.  I have links to all the main downloads at http://mediacomputation.org .

This is a maintenance release.  Thanks to Nina Koch’s student, Henry, we have fixes for colorizing and some other problems.  Henry has also written code to allow for capture of keystrokes and mouse movement in a picture window, so that you could build some simple games.  I’ll save that for JES 5.10.
I don’t do JES releases that often, so in-between, I forget how painful cross-platform development is. JES is all written in Java and Jython, which means we “write once, test everywhere.”  I developed mostly on Mac OS X, but makensis (for Windows Installers) doesn’t work on Mac OS X.  So I ran Ubuntu in VirtualBox to build the Windows installer and test the Linux version.  But I still had to test on Windows (e.g., to make sure that the Sound Explorer was fixed).  It’s all details —  ls here vs. dir/w there, can’t install Oracle Java from Ubuntu installer, remembering sudo apt-get, Lenovo toolkit updater interrupting installations…
From Github:
 Fixes in JES 5.02 (with many thanks to HenryStevens and sportsracer48 for fixes):
  • Fixes a problem if you quit during raw_input that you can’t do another raw_input
  • Makes the Sound explorer fully functional again
  • Fixes colorizing
  • Makes autosave work again
  • Fixes a threading error if you hit return too rapidly in the Command Area
  • Unicode characters in input file get flagged. (Jython can’t execute a line with unicode characters on it.)

In addition,

You can find all the fourth edition Powerpoint slides (including a 68Mb zip of all of them) at http://coweb.cc.gatech.edu/mediaComp-teach/60. I’ve put some of the Peer Instruction question slides into the chapter PPT slide decks, but you can find more at the instructors-only website (see the Media Computation website for more on the teacher website).

Most of the changes are in the early chapters. Chapter 3 on text and language manipulation is all new. The latter chapter PPT slide decks have a few new slides in each deck, including:

  • Creating state-preserving versions of picture manipulation functions in Chapter 16 on Functional Programming
  • Subclassing Picture and Sound to move functions into methods in Chapter 17 on Object-oriented Programming
  • Recursive turtle patterns, which are possible with an improved Turtle class in JES 5 in Chapter 17

May 15, 2015 at 7:59 am Leave a comment

Fourth edition of Python Media Computation released today: Teacher resources and desirable difficulties

Python-4ed-MediaComp-cover

According to Amazon, the Fourth Edition of the Python Media Computation book is released today (see page here). That’s the new cover above. I’ve been working on the 4th edition for most of the summer. Some of the bigger changes are:

  • Before we manipulate pictures, we manipulate letters, words, and language, e.g., build “MadLib” and “koan” generators, and encoding and decoding keyword ciphers. Language is a medium, too, and it’s easier to get started (for some folks) with the smaller-iteration loops of text before getting to the thousands-of-iterations loops of pixels in a picture. It’s an optional chapter — everything introduced there gets introduced again later.
  • Since the new version of JES fixed a round-off error in the Turtle class, we can do recursive turtle manipulations now (which tended to get messed up in earlier forms of JES).
  • I juggled content around so that we do more with conditionals and querying the pixel for its position, before we introduce nested loops. Nested loops are really hard for students, and I learned (from seeing the code that my students wrote) that they can do far more than I’d guessed with single loops — even with multiple pictures. I included more of that.
  • I have tried (for the last two editions) to provide screen-scraping examples, e.g., writing code to pull weather, news, or friends’ information from websites.  It’s getting harder and harder to write that kind of code.  Instead, I decided to provide more code that parses CSV files, as can be found at Open Data Journalism sites (like at The Guardian) and sources like the US Census.  The examples are still about parsing out useful information, but it’s a lot easier to parse CSV and encouraged at these sites.
  • There are more end of chapter problems, and new pictures.  And trying to catch all the errors in the Third Edition that master teachers like Susan Schwartz (at West Point) found.

We’re working on teacher resources now. Currently in development (aiming to have ready in the next couple months) the Powerpoint slides for each chapter of the book, a collection of all the code in the book for teachers, and a solutions manual for every end of chapter problem. These are surprisingly controversial. There are lots (mostly University) teachers who think that I shouldn’t provide any of these resources — teachers should be able to develop all of those themselves. Most of the high school and community college teachers I know appreciate having them.

In searching for the Fourth Edition on Amazon, I read the comments on the Third Edition (see here). Authors probably shouldn’t read the reviews of the book — they’re painful. But I did, and even worse, I actually responded.

Here is a quote from one, titled “False Advertising.”

Its biggest problem: false advertising. This is NOT a book on Python, it’s about JYTHON – A Java based imitation of Python.
Why? Well, there’s some pretty software, available to download, which uses the the JRE. The author chose to stick with this “easy learning environment” and basically cripple anyone wanting to write Python code for Blender, Maya, Android etc.

You may learn to program from this text, but don’t expect a trouble-free life when you get exposed to the real language.

Here was my response:

Everything in this book is useful when wanting to write Python code for Blender, Maya, Android, etc. This is an introductory book on data, loops, conditionals, and objects. Those parts of Python are identical in this book and in the Python that you’ll use in Blender, Maya, and Android. For introductory Python programming, Jython and CPython are exactly the same.

I was surprised to see the original commenter responded. His point was that some kinds of friction, in dealing with the “real world” is desirable:

As an introductory book, I would expect a section on how to install and configure Python. Written covering Windows, Linux, and the Mac OSX. There is no such section; the whole point of Jython is to “hide” this technical level. Which is fine for learning loops etc. but leaves a student lost when encountering Python out in the real world.

It’s an interesting perspective, kind of a “rugged individualism” approach. I do agree with the notion of desirable difficulties in learning (see more here),  but don’t agree that installing Python is one of those.  Do most Python programmers install Python themselves, or is it already installed on the servers, computers, etc. that they will be programming? Is it a critical part of learning a language? Is it significantly different than installing JES (try that here)? Are you “lost” and unable to program if you don’t install it yourself first?

A sad addendum to this story: Our Media Computation data structures book (see the Amazon page here) has gone out of print. The publisher didn’t notify us. Someone approached us about using the book, and was told that it was out of print. When I queried Pearson, they admitted it. More, because it’s not out of print everywhere (I guess it’s available in some non-US markets), Pearson won’t let us post the content anywhere. It’s a dead book now.

January 26, 2015 at 8:28 am 10 comments

African-American students preference for graphical or text-based programming languages depended on career goals

One of the results from Betsy DiSalvo’s dissertation on Glitch (see a post on that work) that I found most interesting was that there wasn’t a clear winner between graphical, drag-and-drop programming (Alice) and text-based programming (Python).  She has now written up that part of the dissertation work, and it’s linked below.

Cursor_and_Betsy-Alice-Python_pdf__page_3_of_4_

To determine appropriate computer science curricula, educators sought to better understand the different affordances of teaching with a visual programming language (Alice) or a text-based language (Jython). Although students often preferred one language, that language wasn’t necessarily the one from which they learned the most.

via IEEE Xplore Abstract – Graphical Qualities of Educational Technology: Using Drag-and-Drop and Text-Based Programs for Intro….

January 12, 2015 at 8:39 am 5 comments

JES 5 Now Released: New Jython, Faster, Updated Watcher, with Jython Music

Matthew Frazier is an undergraduate at North Carolina State University who contacted me this last Spring.  He was going to be in Atlanta for a couple of months and was looking for a research opportunity.  Barbara and I had just been talking about how JES needed to be updated.  I checked his references and hired him without ever meeting him.  Wow, did that work great!
JES 5 (the Jython Environment for Students) has just been released at: https://github.com/gatech-csl/jes/releases/tag/5.010.  Matthew did a great job updating our workhorse for Media Computation Python (which was originally developed in Summer 2002 and is still used daily).  JES includes a full implementation of Jython, plus support for media manipulation — libraries, help functions, and explorers for looking at individual pixels and samples. Here’s a one-screen overview of JES (click on it to make it bigger):
introJES
JES window to left with program area and command area (REPL), Watcher button for debugger, two image explorers, and one sound explorer.  Help is under JES Functions menu and Help menu.
Some of the things he did for JES 5 include:
  • First, we’re on github!  Come join us in stomping out bugs and making JES even better!
  • Upgrading the Jython interpreter to version 2.5, making available new language features and speeding up many user programs.  I have been working on the 4th edition of the Python MediaComp book this summer, and have introduced the time library so that users can actually time their algorithms (one of those CS Principles ideas), so I had ready-made programs to run in both JES4.3 and JES5.0.  The speed doubled.
  • Adding code to JES and the installers to support double-clicking .py files to open them in JES, on all supported platforms.
  • Bundling JMusic and the Jython Music libraries, allowing JES to be used with the text “Making Music with Computers” by Bill Manaris and Andrew Brown.  This is super exciting to me.  All of their examples (like these) work as-is in JES 5 — plus you can do sampled sound manipulations using the MediaComp libraries.  The combination makes for a powerful and fun platform for exploring computation and sound.  My thanks to Bill who worked with us in making everything work in JES.
  • Adding a plugin system that allows developers to easily bundle libraries for use with JES.
  • Fixing the Watcher, so that user programs can be executed at arbitrary speeds.  This has been broken for a long time, and it’s great to have it back.  When you’re looking for a bug in a program that loops over tens of thousands of pixels or sound samples, the last thing you want is a breakpoint.
  • Adding new color schemes for the Command Window, which allow users to visually see the difference between return values and print output.  This was a suggestion from my colleague Bill Leahy.  Students when first learning return can’t see how it does something different from printing.  Now, we can use color to make the result of each more distinctive.  Thanks to Richard Ladner at ACCESS Computing who helped us identify color palettes to use for colorblind students, so we can offer this distinction in multiple color sets.

returnedPrinted

  • Fixing numerous bugs, especially threading issues.  When we first wrote JES, threading just wasn’t a big deal.  Today it is, and Matthew stomped on lots of threading problems in JES 5.  We got lots of suggestions and bug reports from Susan Schwartz, Brian Dorn, and others which we’re grateful for.

Thanks to Matthew for pulling this all together!  Matthew’s effort was supported by NSF REU funding.

September 18, 2014 at 8:49 am 1 comment

Older Posts


Recent Posts

October 2017
M T W T F S S
« Sep    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Feeds

Blog Stats

  • 1,436,882 hits

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 5,153 other followers

CS Teaching Tips