I teach physics at a community college, and ca. 2000 I experimented
with using python as a teaching tool. The point wasn't to teach
programming per se, but simply to give students a way of solving
problems numerically when there isn't any way to get a closed-form
solution using algebra or calculus. Other physics teachers have done
similar things using spreadsheets, but personally I think that's
a horrendous approach -- partly because spreadsheets aren't
standardized the way programming languages are, and partly because
spreadsheets aren't readable in the way that code is. I think my
experiment was partly successful and partly unsuccessful. I'm now
about to teach the same course again for the first time in a long
time, and am thinking about the possible merits of switching from
python to javascript. I'd be grateful for comments from anyone on
whether this seems like a good idea, or on certain aspects of what
I'm thinking of doing.
One hurdle I encountered with python was that I had to make sure
my students had access to a python interpreter. This meant downloading
a large application and installing it. This seems like a clear win
for js, since everyone who has firefox installed can run one-liners
in the console, and I would think it would be fairly straightforward
to supply a browser-based interface that would allow the user to
write simple javascript programs and run them.
It was also a nuisance in python that a computation as simple as
taking the square root of 2 required this much code:
import math
print math.sqrt(2.)
Also, it confused students that
print 2/3
gave 0 as its output. I found that many students were confused by
the significance of whitespace in python.
None of this was an insurmountable hurdle, but it
took up time and got in the way. (I remember in particular one
student, a middle-aged immigrant, who not only had never done any
computer programming, but didn't know how to hold a mouse.)
In js, the first example above becomes simpler:
Math.sqrt(2) ,
and the second one works as one naively expects.
I'm also thinking about the idea of making things a little easier
on the students by exposing some globals. For example, their own
code could run in an environment where the following has already
been done:
sqrt=Math.sqrt;
Thus they can simply do
sqrt(2)
and get an answer.
Are there any well-implemented, open-source, browser-based environments
for writing simple javascript programs? I would want to incorporate
such a thing as a component in some open-source courseware I've
written (http://www.lightandmatter.com/spotter/spotter.html), probably
using some ajaxy method for allowing the user to save his programs
on my server.
Thanks in advance for any advice or comments!
-Ben