473,770 Members | 1,954 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
35 1556
Am 15.10.2007 03:57 Randy Webb wrote
You should try it before being thankful. The proper one is alert, not
Alert. And you might find that javascript: is more successful than
jscript: is.
You should try them out yourself, before being so criticful ;-).
They work as advertised.

This is Microsoft InternetExplore r we are talking about and MS has its
own Javascript implementation, called JScript and JScript seems to be
case-insensitive.

For Firefox the right address-line would be (as you correctly indicated):

javascript:aler t(5*1.015)

(and the result would not be rounded)

But you knew that already. Or didn't you ;-)

--
Andreas M.
Oct 15 '07 #21
On Oct 15, 5:15 am, "Andreas M." <foo...@invalid .invalidwrote:
Am 15.10.2007 03:57 Randy Webb wrote
You should try it before being thankful. The proper one is alert, not
Alert. And you might find that javascript: is more successful than
jscript: is.

You should try them out yourself, before being so criticful ;-).
They work as advertised.

This is Microsoft InternetExplore r we are talking about and MS has its
You are the only one talking about IE.
own Javascript implementation, called JScript and JScript seems to be
case-insensitive.
JScript is most assuredly case-sensitive. Regardless, alert (or Alert
as you call it) is a host object method, not part of the language.
The host object (window) has case-sensitive methods (as is the norm),
so window.Alert fails. Furthermore, I typed your jscript: example
into IE7's address bar and it did nothing.

Oct 15 '07 #22
In comp.lang.javas cript message <ieOdnX4sg8M1CY _anZ2dnUVZ_sejn Z2d@comcas
t.com>, Sun, 14 Oct 2007 17:17:42, McKirahan <Ne**@McKirahan .com>
posted:
>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.
<FAQENTRYOmit last two words.

In the CLJ FAQ, the topic is implicitly Javascript. Restating it may
suggest that the problem is unique to Javascript, which is not the case
(although it can be less obvious in some other languages).

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v6.05 IE 6
news:comp.lang. javascript FAQ <URL:http://www.jibbering.c om/faq/index.html>.
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Oct 15 '07 #23
Andreas M. said the following on 10/15/2007 5:15 AM:
Am 15.10.2007 03:57 Randy Webb wrote
>You should try it before being thankful. The proper one is alert, not
Alert. And you might find that javascript: is more successful than
jscript: is.

You should try them out yourself, before being so criticful ;-).
They work as advertised.
Maybe you would care to explain why the alert didn't work in MSIE7 until
I changed the Alert to alert and the jscript to javascript.
This is Microsoft InternetExplore r we are talking about and MS has its
own Javascript implementation, called JScript and JScript seems to be
case-insensitive.
Even testing again just now, it still won't give an Alert. And again,
changing it to alert and javascript gives me the alert.
For Firefox the right address-line would be (as you correctly indicated):

javascript:aler t(5*1.015)

(and the result would not be rounded)

But you knew that already. Or didn't you ;-)
Yes. And javascript:aler t(5*1.015) works in both. But you knew that
already. Or didn't you? ;-)

--
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 15 '07 #24
Dr J R Stockton said the following on 10/15/2007 12:25 PM:
In comp.lang.javas cript message <ieOdnX4sg8M1CY _anZ2dnUVZ_sejn Z2d@comcas
t.com>, Sun, 14 Oct 2007 17:17:42, McKirahan <Ne**@McKirahan .com>
posted:
>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.

<FAQENTRYOmit last two words.
If you omit them then it implies that it never gives it exactly and that
isn't true.
In the CLJ FAQ, the topic is implicitly Javascript. Restating it may
suggest that the problem is unique to Javascript, which is not the case
(although it can be less obvious in some other languages).
And not stating it implies it occurs in all languages and /that/ is not
true.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
FAQ Notes: http://www.jibbering.com/faq/faq_notes/faq_notes.html
ECMAScript Language Specification via FAQ2.6
Oct 15 '07 #25
In comp.lang.javas cript message <11************ **********@e34g 2000pro.go
oglegroups.com> , Mon, 15 Oct 2007 02:41:35, David Mark
<dm***********@ gmail.composted :
>This is Microsoft InternetExplore r we are talking about and MS has its

You are the only one talking about IE.
>own Javascript implementation, called JScript and JScript seems to be
case-insensitive.

JScript is most assuredly case-sensitive. Regardless, alert (or Alert
as you call it) is a host object method, not part of the language.
The host object (window) has case-sensitive methods (as is the norm),
so window.Alert fails. Furthermore, I typed your jscript: example
into IE7's address bar and it did nothing.
In the address bar, in IE6:

javascript:aler t(9) works as expected
jsCRipT:alert(9 ) ditto, but is changed to
vbscript:alert( 9) which works as line 1

In fact, all sorts of strange misspellings are accepted and converted to
either javascript: or vbscript: .

The language javascript is case-sensitive; but the language does not
contain the word javascript.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demo n.co.uk/- FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "" (SonOfRFC1036)
Oct 15 '07 #26

"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.

Thanks in advance for any advice or comments!

-Ben

Just read through a weeks worth of this newsgroup to see the confusion
Javascript can bring to expert users. I think Javascript should only be
taught to people who want to learn Javascript, not as a tool for learning
something else.

Beginner's All-purpose Symbolic Instruction Code was written explicitly for
your purpose.
Oct 16 '07 #27
Am 15.10.2007 11:41 David Mark wrote
You are the only one talking about IE.
Which browsers do support the vbscript: and jscript: protocols nativley
except IE? This is what we are talking about, so we are talking about IE.
JScript is most assuredly case-sensitive. Regardless, alert (or Alert
as you call it) is a host object method, not part of the language.
I do not call it "Alert". VBScript seems to call it that way. All I did
was to change the protocol in the uri within IE and it worked the same
as it did with the vbscript protocol. The reason I did so was, because
the original commentor was not interested in VBScript but Javascript, so
this was an obvious test to help him.
The host object (window) has case-sensitive methods (as is the norm),
so window.Alert fails. Furthermore, I typed your jscript: example
into IE7's address bar and it did nothing.
It works in IE6. This lead to my comment. Seems MS tightened the belt on
their whole WWW-pants with IE7.

--
Greetings,
Andreas M.
Oct 16 '07 #28
In comp.lang.javas cript message <2N************ *********@gigan ews.com>,
Mon, 15 Oct 2007 16:21:54, FAQEditor <cl****@comcast .netposted:
>Dr J R Stockton said the following on 10/15/2007 12:25 PM:
>In comp.lang.javas cript message <ieOdnX4sg8M1CY _anZ2dnUVZ_sejn Z2d@comcas
t.com>, Sun, 14 Oct 2007 17:17:42, McKirahan <Ne**@McKirahan .com>
posted:
>>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.
<FAQENTRYOmit last two words.

If you omit them then it implies that it never gives it exactly and
that isn't true.
No. The whole FAQ is talking about javascript. Any further emphasis on
javascript suggests that, in the current respect, javascript is unique
or nearly so.

>In the CLJ FAQ, the topic is implicitly Javascript. Restating it may
suggest that the problem is unique to Javascript, which is not the case
(although it can be less obvious in some other languages).

And not stating it implies it occurs in all languages and /that/ is not
true.
Not in educated English.

I suggest, though, that it does occur in most computer languages; though
many conceal it from the casual user by doing more rounding on
converting number to string.

--
(c) John Stockton, Surrey, UK. ??*@merlyn.demo n.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demo n.co.uk/- FAQish topics, acronyms, & links.

Food expiry ambiguities: <URL:http://www.merlyn.demo n.co.uk/date2k-3.htm#Food>
Oct 16 '07 #29
On Oct 16, 5:06 am, Dr J R Stockton <j...@merlyn.de mon.co.ukwrote:
In comp.lang.javas cript message <2NKdnd1blalCVo 7a4p2d...@gigan ews.com>,
Mon, 15 Oct 2007 16:21:54, FAQEditor <clj...@comcast .netposted:
Dr J R Stockton said the following on 10/15/2007 12:25 PM:
In comp.lang.javas cript message <ieOdnX4sg8M1CY _anZ2dnUVZ_sejn Z2d@comcas
t.com>, Sun, 14 Oct 2007 17:17:42, McKirahan <N...@McKirahan .com>
posted:
>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.
<FAQENTRYOmit last two words.
If you omit them then it implies that it never gives it exactly and
that isn't true.

No. The whole FAQ is talking about javascript. Any further emphasis on
javascript suggests that, in the current respect, javascript is unique
or nearly so.
Have you ever heard about "never cry wolf"?

It is generous of Randy to maintain the FAQ and when something is just
a minor matter of author writing style how about just letting it be?
Otherwise the FAQ may loose it's maintainer.

Peter

Oct 16 '07 #30

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

Similar topics

20
2361
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
29774
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
4379
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
2862
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
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9453
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
10254
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...
0
10099
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6710
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
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.