473,763 Members | 3,855 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JS as a teaching language

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
Oct 14 '07 #1
35 1554
"Ben Crowell" <cr*******@ligh tSPAMandISmatte rEVIL.comwrote in message
news:47******** *************** @roadrunner.com ...
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.
JavaScript math may be problematic:

4.7 Why does simple decimal arithmetic give strange results?

For example, 5*1.015 does not give exactly 5.075 and 0.06+0.01
does not give exactly 0.07 in javascript.

comp.lang.javas cript FAQ - 9.88 - 2007-10-12
http://jibbering.com/faq/index.html
Oct 14 '07 #2
Am 14.10.2007 23:59 Ben Crowell wrote
I teach physics at a community college, and ca. 2000 I experimented
I ain't that much of a number-cruncher, but I got some skills in
installing software ;-)

Javascript may be more easy to grab and more freeform as Python is (I do
both), but since Python is being written by a mathematician I would
assume, that for your particulare task it may be suited better.
Should you stay with Python I would recommend you to have a look at this:

---------------------- http://ipython.scipy.org -----------------------
IPython: an Enhanced Python Shell

IPython is a multiplatform, Free Software project (BSD licensed) that
offers:

* An enhanced Python shell designed for efficient interactive work.
It includes many enhancements over the default Python shell, including
the ability for controlling interactively all major GUI toolkits in a
non-blocking manner.
* A library to build customized interactive environments using
Python as the basic language (but with the possibility of having
extended or alternate syntaxes).
* A system for interactive distributed and parallel computing (this
is part of IPython's new development).
------------------------------------------------------------------------
Basically it is an enhanced Python Shell with user definable startup
configuration and what not. Very comfortable!
I'm also thinking about the idea of making things a little easier
on the students by exposing some globals. For example, their own
This may work well with iPython (see above)
Are there any well-implemented, open-source, browser-based environments
for writing simple javascript programs? I would want to incorporate
Of course, Javascript is better suited for beginners, especially since
it is less loaded. One can lose overview with Python pretty fast.

Check these out:

http://jconsole.com/
or
http://mochikit.com/examples/interpreter/index.html

Good luck!

--
Regards,
Andreas M.
Oct 14 '07 #3
Am 15.10.2007 01:03 McKirahan wrote
Perhaps you could use Internet Explorer with VBScript...

Type the following in the Address bar and hit Enter:
vbscript:Alert( 5*1.015 )
or
vbscript:Alert( 2^.5 )
or
jscript:Alert( 5*1.015 )
or
jscript:Alert( 2^.5 )

;-)

--
Greetings,
Andreas M.
Oct 14 '07 #4
Ben Crowell wrote:
<snip>
One thing that occurs to me that might be somewhat more of
an issue would be the lack of an exponentiation operator.
I would imagine people trying to do something like this:
2^.5 ,
Math.pow(2, 0.5); //?
and expecting the square root of two as a result.
That would be unfortunate, as the square root of 2 does not exist.
I suppose it's
not possible to overload operators in js.
Not in standard (ECMA 262 defined) javascript.

Richard.
Oct 14 '07 #5
Andreas M. wrote:
Check these out:

http://jconsole.com/
or
http://mochikit.com/examples/interpreter/index.html
Excellent -- that was exactly what I was looking for!
Thanks!
Oct 14 '07 #6
Richard Cornford said the following on 10/14/2007 7:18 PM:
Ben Crowell wrote:
<snip>
>One thing that occurs to me that might be somewhat more of
an issue would be the lack of an exponentiation operator.
I would imagine people trying to do something like this:
2^.5 ,

Math.pow(2, 0.5); //?
>and expecting the square root of two as a result.

That would be unfortunate, as the square root of 2 does not exist.
It doesn't? I say it does. What doesn't exist is the potential to
display it accurately on a computer.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 14 '07 #7
McKirahan wrote:
Perhaps you could use Internet Explorer with VBScript...

Type the following in the Address bar and hit Enter:
vbscript:Alert( 5*1.015 )
or
vbscript:Alert( 2^.5 )
I don't want to use proprietary software for this. My students
may not have access at home to proprietary software such as IE.
Oct 15 '07 #8
On Oct 15, 12:41 am, Randy Webb wrote:
Richard Cornford said the following on 10/14/2007 7:18 PM:
>Ben Crowell wrote:
<snip>
>>and expecting the square root of two as a result.
>That would be unfortunate, as the square root of 2
does not exist.

It doesn't? I say it does.
<snip>

No the square root of 2 does not exist. There is a reductio ad
absurdum proof that shows that if 2 has a square root then it is
necessary for there to exist a number that has magnitude but is
simultaneously positive and negative. That is impossible so 2 cannot
have a square root. Hence the square root of 2 is one of the
'imaginary' numbers.

Richard.

Oct 15 '07 #9
On Oct 14, 7:58 pm, Richard Cornford <Richard.Cornf. ..@googlemail.c om>
wrote:
On Oct 15, 12:41 am, Randy Webb wrote:Richard Cornford said the following on 10/14/2007 7:18 PM:
Ben Crowell wrote:
<snip>
>and expecting the square root of two as a result.
That would be unfortunate, as the square root of 2
does not exist.
It doesn't? I say it does.

<snip>

No the square root of 2 does not exist. There is a reductio ad
absurdum proof that shows that if 2 has a square root then it is
necessary for there to exist a number that has magnitude but is
simultaneously positive and negative. That is impossible so 2 cannot
have a square root. Hence the square root of 2 is one of the
'imaginary' numbers.
I think irrational is the correct term, but it has been a while since
I cared about such things. IIRC, imaginary numbers are even roots of
negative numbers.

Oct 15 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
2360
by: Mediocre Person | last post by:
Well, after years of teaching grade 12 students c++, I've decided to make a switch to Python. Why? * interactive mode for learning * less fussing with edit - compile - link - run - debug - edit - compile - link - run -..... * lots of modules * I was getting tired of teaching c++! Bored teacher = bad instruction.
14
1828
by: Gabriel Zachmann | last post by:
This post is not strictly Python-specific, still I would like to learn other university teachers' opinion. Currently, I'm teaching "introduction to OO programming" at the undergrad level. My syllabus this semester consists of a bit of Python (as an example of a scripting language) and C++ (as an example of a compiled language). With C++, I go all the way up to meta-programming. My question now is: do you think I should switch over to...
822
29705
by: Turamnvia Suouriviaskimatta | last post by:
I 'm following various posting in "comp.lang.ada, comp.lang.c++ , comp.realtime, comp.software-eng" groups regarding selection of a programming language of C, C++ or Ada for safety critical real-time applications. The majority of expert/people recommend Ada for safety critical real-time applications. I've many years of experience in C/C++ (and Delphi) but no Ada knowledge. May I ask if it is too difficult to move from C/C++ to Ada?...
16
4378
by: msnews.microsoft.com | last post by:
I am teaching C# to my 11 year old child. One challenge is that all the C# books I own and that I have seen in bookstores are full of language that is not easily comprehended by a student at that age. Can anyone recommend books (or perhaps websites) tuned for younger audiences? BTW, its amazing how fast a student can absorb this kind of information at that age. Lucky them! Thanks, Bruce
24
2859
by: Richard Aubin | last post by:
I'm really new to vb.net programming and programming in general. I would like to teach myself on how to program effectively and I have the financial and time resources to do so. Can I anyone recommend and point me in the right direction where I should start? -- Richard Aubin
0
1152
by: Wingware | last post by:
Hi, We're pleased to announce the first public beta release of Wing IDE 101, a free scaled back edition of Wing IDE that was designed for teaching introductory programming courses. We are releasing Wing IDE 101 to the general public in the hopes that it may help others teach with or learn Python. Wingware also offers educational pricing for Wing IDE Professional, including steep discounts for class room use. If you are interested in...
0
9389
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10149
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9943
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9828
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8825
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7370
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5410
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3529
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.