Is Javascript the new "Basic"?

T

The Natural Philosopher

Johannes said:
Bill H :


I think it is fair to say that it could be the new BASIC. One of my friends
(and occasionally colleague) teaches a Programming 101 course in
Javascript, with great success.

Personally, I find that the close connection with browsers introduces
quite difficult concepts, like self-modifying code, the possibility to open
a window with another program in it which itself may open another window,
etc. So if I were again to teach something like my friend, I would insist
on doing things first in an old-fashioned console, say with spidermonkey.
But apparently, his students do not have the same sort of perverted
curiosity mine had when I taught Programming 101 courses.

By the way, it is entirely possible to get all kinds of quite serious
programming languages for free, from C++ and Ada to Prolog and Haskell.
Even FORTRAN and COBOL, if anybody is still interested!
Don't forget ALGOL, LISP, FORTH, JAVA, PASCAL, PERL, :)
 
I

Ivan Marsh

Ivan Marsh :


Why? Good arguments here would make the discussion more interesting.

I agree.
What is wrong with Javascript for other uses than client-side web
applications, and specifically as a beginners' first programming
language? For instance, what would you candidate be?

Not a thing. But as a first programming language I wouldn't suggest one
whose primary function, client-side scripting for web browsers, has no
clear dividing line between the language specification that's standardized
and DOM access which is not.

Seems if someone was asking about JavaScript as a first language it might
be nice to warn them about that... which is exactly what I did.

Perhaps I'm the only person who assumed that the OP might have been
talking about programming with a browser as standard out rather than the
console.

The fact that you can use JavaScript outside of the browser sounds like
one of those high-minded concepts you were talking about earlier...
especially considering the first 100,000+ results you're going to get back
on any search for JavaScript information is going to be about client-side
scripting rather than writing for the console.

Amusingly enough if you google "javascript outside the browser" the first
paragraph on the first link reads:

"When you think of Javascript, you generally think of the web."
 
T

The Natural Philosopher

Johannes said:
Stevo :


That is what worries me about that approach, actually.
The world works that way, Johannes.

1% of people explore and make mew tracks. 5% understand where they have
gone. 95% learn how to take the bus.
 
T

The Natural Philosopher

Johannes said:
The Natural Philosopher :


I don't think your "always" can be safely predicted to last more than 10
years or so. There will probably be other messes by then, but I expect a
working core of standard, Open Source Web-based solutions (actually more
centered on XML than on whateverscript, but that's another story) to be
well established before that.
Indeed. I really meant 'as long as IE remains proprietary, it's always'...
 
T

The Natural Philosopher

Johannes said:
Ivan Marsh :


In ordinary procedural languages, it becomes difficult the moment you
start writing loops. Since a firm grasp of the logic about loop invariants
and exits is IMHO what makes the difference between a programmer and
someone who plays with a computer, this should happen as soon as possible,
with minimal diversions about compilers, linkers and what not. That was
what made BASIC so popular, what inspired other (and even better)
languages for beginners like Logo, and where I see perhaps the most
important role of all for Javascript.

Programming is, in the words of Edsger W. Dijkstra, "one of the most
difficult branches of applied mathematics". Ever since I started
programming nearly 40 years ago, it has worried me that many people
imagine that the main difficulty is mastering syntax, and that once they
have figured out when to use commas and when semicolons, they have learned
enough. EWD considered this a menace to civilisation, and I agree.

I consider EWD a menace to civilzation, but there ya go ;-)

The fact that Javascript also allows one to make fancy and funny things on
the Web is of course a most welcome motivating factor. From there, it is
possible to carry on and actually write useful applications. But one has
to learn the logic. That is what really matters, not details about the way
Microsoft misinterprets the DOM.

Only if you are an academic. 90% of the world just wants boring
workmanlike code that does the job its supposed to.
 
H

Hal Rosser

Bill H said:
25 years ago every computer came with some form of Basic interpreter
so you could use yoru computer without having to buy more software. Is
Javascript (teamed with HTML) set to become the new Basic, where
anyone with a computer can start writing code without having to
purchase any expensive languages?

Bill H
Basic has come around again.
VB2005 express edition is free - its the new basic.
I remember having to number each line, too.
Basic has grown up and its easier to program now.
 
P

Paul E. Schoen

Stevo said:
Ahh, memories. My first computer was a ZX81 (KIT) with 1KB of memory. I
couldn't afford to buy it pre-built, or to add the 16KB memory pack.
Programming Games in Z80 assembler after school. Fun times :) I never got
BASIC until I upgraded to a BBC Micro. Fond memories of playing Chuckie
Egg that I'd burned onto an EPROM.

I still have an original Sinclair ZX81 and a newer Timex T1000?, and I
added the 16 K memory pack kit. I had books on assembly language, and I
even designed an interface that would allow the ZX81 to print to a
Centronics port and dot matrix printer. My first experience with computers,
around 1966, was with an IBM 7094 at John Hopkins. We used punch cards and
programmed in "AFBIC", or "All Fortran BASIC Interpretive Compiler". An
acronym within an acronym.

I enjoyed following this thread. My language of choice is Borland Delphi,
but I am learning JavaScript so I can make web based applications. I've
also used standalone JScript apps as alternatives to batch files.

Paul
 
D

Dr J R Stockton

Fri said:
True -- but I admit I have occasionally toyed with the idea of creating
a JavaScript environment for straight-up application programming.

I'm uncertain of how much you mean to embrace by the words "environment"
and "application" there; but MS WSH allows application programming in
Javascript.

Question : In off-the-shelf Vista, there must be a javascript engine for
reading Web pages. How else can Javascript be used in o-t-s Vista - is
there a recognisable WSH or replacement with it, can it script within
Office, etc.?

The FAQ might require updating on the subject, since it covers all use
of the language whether or not fully standards-compliant or extended.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.
 
D

Dr J R Stockton

In comp.lang.javascript message said:
The fact that you can use JavaScript outside of the browser sounds like
one of those high-minded concepts you were talking about earlier...
especially considering the first 100,000+ results you're going to get back
on any search for JavaScript information is going to be about client-side
scripting rather than writing for the console.

Inaccurate. The 14th reference is ECMA-262.

Probably the first thing to learn about non-browser Javascript is the
name JScript.
 
J

John W. Kennedy

Johannes said:
John W. Kennedy :
Spidermonkey already is that, to a certain extent - it suits me, but I
learned with punch cards, so I am easily satisfied.
What else do you think would be needed? I would be very happy to
contribute to a project.

Spidermonkey is the first half. The second half is the -- damn! I forget
the proper jargon -- the magic object that has all its attributes loaded
for free into the namespace, like the "window" object when JS is being
used in a browser environment. Say it's an object named "system". It
contains various methods and properties to provide file access, window
access, etc., etc., etc..

It might be cooler to use Rhino and make wrappers for the Java API
objects, instead, but in a cleaner version that doesn't expose Java's
historic dead ends (raw AWT programming, stream function that has been
superseded by readers and writers, etc.).

Actually, for all I know, such a gadget may already exist.

It's just a notion, I haven't really worked it out.


--
John W. Kennedy
"There are those who argue that everything breaks even in this old dump
of a world of ours. I suppose these ginks who argue that way hold that
because the rich man gets ice in the summer and the poor man gets it in
the winter things are breaking even for both. Maybe so, but I'll swear I
can't see it that way."
-- The last words of Bat Masterson
 
D

David Cox

Paul E. Schoen said:
I still have an original Sinclair ZX81 and a newer Timex T1000?, and I
added the 16 K memory pack kit. I had books on assembly language, and I
even designed an interface that would allow the ZX81 to print to a
Centronics port and dot matrix printer. My first experience with
computers, around 1966, was with an IBM 7094 at John Hopkins. We used
punch cards and programmed in "AFBIC", or "All Fortran BASIC Interpretive
Compiler". An acronym within an acronym.

I enjoyed following this thread. My language of choice is Borland Delphi,
but I am learning JavaScript so I can make web based applications. I've
also used standalone JScript apps as alternatives to batch files.

Paul

Its good to hear the young folk talk. My first computer was the Sinclair
MK14, programmed in hex. I have come through Basic, Fortran, Cobol, PL/I, to
the joys of trying to learn js.

A long journey through seeing "error in line 14" with line numbers to the
modern sophistication of seeing "error in line 14" messages without line
numbers.
Through the simplistic I% to get an integer to having to use a function to
get one.

My earliest contribution to interfacing was to conceive and design the
Kempston Joystick. It made a lot of money for someone else.

David F. Cox
 
D

David Cox

Ivan Marsh said:
#include <iostream.h>

int main(void)
{
cout << "Hello World!";
return 0;
}

It's the same with any language.

JavaScript on the other hand is difficult in the sense that the DOM is
variable between browsers and it's interpretation is at the whim of the
browser developer.

It is not "the same in any language".
I was on a PL/I contract when I bought A Tandy Model 4. I was bragging about
it, and my boss said it was not a "real" computer, and challenged me to
write the equivalent of a PL/I program to print the days between two given
dates. I did it in a one line Microsoft Basic PRINT statement, almost typing
the algorithm word for word.

David F.Cox
 
D

David Cox

Stevo said:
I think it IS the new Basic in the terms Bill meant. It has a low barrier
to entry. Any beginner can do view-source on a webpage and look at some
javascript and without understanding too much about why things are the way
they are, they can copy it and make some changes and impress themselves
with a Hello World style program. There's no way a beginner can do that
with Perl, PHP, Java or any C variant. The fact that JavaScript as quite
forgiving when it comes to syntax and isn't strongly typed too helps. They
can get away with missing semi-colons, accidentally declaring globals and
all kinds of minor syntax issues. If I was running an introduction
computer class I'd definitely consider JS a great easy entry language.
Let's face it, what do you need? A browser and a simple text editor.
You've got a billion web pages and google search that can help you with
problems. The people in the QA department where I work, who aren't
Computer Science graduates can all hack themselves a bit of JavaScript
when they're setting up test pages. I don't know how much they really
understand about what they're doing, but they're getting it done. If
anything, I'd say that JS is easier to start than Basic. Back in the days
when I started using Basic, there was no WWW and everything you needed to
know was in a book.

Later versions of DOS basic came with a good help file, and you could start
learning with minimal instruction and no book.
 
J

John Hosking

The said:
1% of people explore and make mew tracks. 5% understand where they have
gone. 95% learn how to take the bus.

1% understand they have gone to Statistics class by taking the bus. ;-)
 
J

Jake Barnes

Ivan Marsh :


I am not suggesting Javascript's use in browsers is secondary to its
existence. I am suggesting that Brendan Eich did an amazing job in
designing a simple, compact and elegant computer language, and that it has
become even better since then. And that as a result, his language may have
uses his employers did not expect. After all, sildenafil (Viagra ®) was
invented as a cure for hypertension.

I agree. I've written Javascript code for web browsers, but the
longest single Javascript gig I ever had was using Javascript for
Adobe Photoshop. It is the only cross-broswer scripting language for
automating Adobe products. I was working for a very large metal
smelting jewelry company in Richmond, Virginia, USA, and my job was to
automate the production of the catalog by developing Javascripts to
tie together the work in Photoshop and the work in InDesign. And
Javascript's use in Adobe products is going to grow greatly, as the
depth of the API has grown greatly in CS 3 products.
 
J

Jake Barnes

The fact that you can use JavaScript outside of the browser sounds like
one of those high-minded concepts you were talking about earlier...
especially considering the first 100,000+ results you're going to get back
on any search for JavaScript information is going to be about client-side
scripting rather than writing for the console.

There is some bias to the results, as Javascript-for-the-web tends to
be discussed openly on the web, whereas Javascript-for-x-niche (where
"x" is any industry) tends to be discussed in password-protected
forums. For instance, using Javascript to automate Adobe products is
an important use of Javascript, but the discussion of it tends to
happen on the Adobe forums, which are behind a password. The one time
I asked a question on comp.lang.javascript about how to automate
Photoshop, I was told that I should probably take my question to the
Adobe forums, which I then did.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,157
Latest member
MercedesE4
Top