

Ask HN: Why isn't Javascript the new BASIC? - fxj

There was a time (ca. 1985) where almost every computer showed a BASIC prompt after switching it on and everybody could just start programming. Many nowadays top programmers found their love for coding by using this (arcane) programming language. Why is this not happening any more? Of course we don't have BASIC on our PCs and Macs and ipads any more, but we have something better: JavaScript.<p>Why, for heavens sake, has nobody written a decent self-contained JavaScript IDE that we all can use right away?<p>Write a HTML5 application that serves as an IDE with all the bells and whistles that JavaScript supports today. jQuery could be part of it. A GUI Editor could be part of it.  The whole app could be self-modifiable. And you could store it in a zipped bookmarklet. Services like www.laterloop.com show how to do that. 
You could distribute the little programs on your website without need for apples app shop. Hell, we could make our own app show and apple could not do anything against it. The apps would run on all platforms that support JavaScript and a decent  subset of HTML5.<p>So where are the top JavaScript programmers that make this a reality? The next generation of young hackers is waiting desperately for it (even they don't know that they do).
======
joeyh
Wasn't it _why who said that coding for the web is hard to get into because it
requires _3_ languages? (javascript, css, html; loosest definition of
"language"). Plus understanding how they fit together; DOM etc. Plus
portability.

People didn't use IDEs with their BASIC in 1985, so your jump to IDEs may miss
the point. But my 1983 BASIC interpreter let me draw a point or a diagonal
line anywhere on the screen; all I had to know was how to get into graphics
mode and how to specify coordinates. 2 lines of code. If you write the same
thing in javascript+html+css, how many lines will it take you?

In the meantime, at least there's <http://logo.twentygototen.org/>

~~~
acqq
Exactly, with the BASIC in my Spectrum (1984) I was able to draw over the
whole screen in full resolution (at that time even the very "bitmapped"
screens were novelty, other computers had special regime for drawings and
another for letters -- Mac, who broke that, came only in 1984, PC users
stopped using text modes only with Windows, which got popular only around
1990) -- one single statement to draw the line, one single statement to draw
the circle... to put that in the loop you needed only two lines more, or you
could even write it in the same line. And no special editor needed, you just
type, press Enter, and the result appeared immediately. And no icons, no
toolbars, title bars... Command, result. Or a few lines of program, result.
Try now to draw something. Try to produce the sounds of notes with it. It was
simple, now it's not, that's why it's not THAT. It's sad that it's so hard
these days to do some basic stuff, like only a few typed words to draw
something etc. Today even languages that should be simple aren't. Import
libraries, reference modules, only to evaluate abs(-2)? Failure of modern
language incarnations...

------
nivertech
You don't need IDE, all you need is REPL. BASIC offered REPL with primitive
line editor. You can use JS REPL:

<http://www.jconsole.com/>

jconsole (based on JavaScript Shell 1.4) Features: autocompletion of property
names with Tab, multiline input with Shift+Enter, input history with (Ctrl+)
Up/Down, Math, help Values and functions: ans, print(string), props(object),
blink(node), clear(), load(scriptURL), scope(object)

5 * 5

25

f = function(X) { return X _X; }

function (X) { return X _ X; }

f(5)

25

print("Hello, World!")

Hello, World!

~~~
x5315
There is a REPL in the WebKit inspector as well as in Firebug. The Internet
Explorer Developer Toolbar may even have one. I'm not sure that an extra
website is strictly required.

------
checker659
fxj meet jsFiddle (<http://www.jsfiddle.net>), jsFiddle meet fxj.

~~~
fxj
very nice. seems to have great potential. a good starting point.

------
arocks
I'm sorry if this might be slightly off-topic, as it focusses on the 'new
BASIC' part of your question. However, the points outlined might be helpful to
understand why Javascript isn't the best first language for pedagogy.

Compared to most languages, Python is possibly the best contender to the title
of 'new BASIC'. It has an implementation that is more consistent than
Javascript's and can even scale up to larger code-bases. The latter, I learnt
in my early days, will soon become a necessity when it becomes difficult to
keep track of your 20K lines of BASIC code!

Python could be a gateway to both server-side and client-side programmer. The
latter could be useful while learning programming and can provide instant
gratification with full-screen graphics say using Pygame/Pyglet. When the
young programmer becomes confident enough that he wants to let his friends
play with his creations, he can create web-apps using Python (say using
Django), which seems to be the distribution mechanism of choice, going
forward.

I agree that having an IDE is perhaps not a necessity compared to a REPL.
There have been IDEs like Turbo Pascal which have near instantaneous compile
times, but the learners tend to become overly dependent on IDEs. They are
often unable to distinguish between the IDE and language, which is clearly
undesirable.

Python works well with modest requirements. It has several REPL
implementations (for e.g. the excellent ipython). On the other hand
development is breezy even with simple syntax highlighting editor (for e.g.
Notepad++).

Javascript has several gotchas which might confuse or dissuade a learner. I
think this is a hangover from its early implementations than a language flaw
per se. However, it prevents me from recommending it to a beginner.

------
all
As joeyh said, jumping to an IDE seems premature. But another problem is the
lack of need. Back in 1980, there just were not that many games and other
apps. A computer was more or less an extension of electronics and was driven
by "How does this thing work?". Now, computers are appliances. And even the
most reliable appliances, as the old Maytag adverts used to show, require
trained "technicians". But I, too, wonder how to recupe that wonder of "How
things work" for the up-and-coming ranks of hackers.

~~~
wazoox
Back in the 80's, people who wanted computers were geeks. Now everybody an his
dog uses a computer; geeks are a tiny part of the whole. I suppose that geeks
who want to know how things work, well, just learn it one way or another. the
remaining 90% of the population won't ever know shit on how a computer works,
because they're absolutely not interested in this matter.

~~~
mechanical_fish
I think this is the answer. JS _is_ the new BASIC - or _a_ new BASIC, anyway -
but it is harder to tell because the audience is more diffuse, and mixed up
with so many other audiences.

In the earliest days of PCs it was easy to spot the BASIC programmers: most
people who owned a PC learned a little. What else was there to do with it? And
computers were expensive, so odds were that if you owned one you were pretty
fond of computers.

Now the situation is like that in music: we are in a golden age of
programming, but it is hard to appreciate because it is so diffuse and varied:
The equivalent of the big arena rock show isn't there.

------
stretchwithme
BASIC was the first language I did anything with. I was a co-op during college
at this company that made 4 wheel drive systems and they were working on an
electronically controlled transfer case.

I was given the task of importing raw data captured at the test track into
very uninformative spreadsheets. I wrote macros to generate charts presenting
all the different parameters. Also very uninformative.

I came up with a much better way to present the data using BASIC. I drew a
picture of a car with 4 wheels. The front wheels turned and the rear wheels
flashed when they lost traction. I had a bar graph showing for the engine and
a transfer case that flashed when power shifted to the front end. You could
vary the speed, run it in a loop and even run it backward.

With this you could actually see the wheels turning under power starting to
break loose and system responding to correct it. Just one problem when they
got it to the test track and looked at data immediately after a test instead
of weeks later: The steering rack actually turns in the opposite direction
that the wheels do, so the wheels turned in the wrong direction!

Thanks, BASIC. good times :-)

------
olegp
Akshell (<http://www.akshell.com>) might fit the bill.

~~~
fxj
akshell: server side javascript development and hosting. sounds interesting,
but is not quite what I had in mind. it should be possible to save the
application locally.

~~~
olegp
There's a command line tool that lets you make a local copy of the code &
support for running apps locally is in the works.

------
antimatter15
In chrome, just type Ctrl+Shift+J (Cmd+Opt+J on Mac) and there's a wonderful
JS console

------
CyberFonic
The problem with JavaScript (ECMAscript) is that it is a language that is
defined without libraries - collection of objects. DOM, etc are objects that
you manipulate with the language and it "provided" by the web browser.

BASIC appealed because it came with simple built-in objects (the weren't
called that) which allowed for easy programming with quick visual display. And
of course, the expectations weren't has high back then either.

------
drblast
Sounds like a good idea, I'll start working on it. Do you have any other ideas
for features?

~~~
fxj
\- store as bookmarklet (zipped)

\- upload to provider (google apps? dropbox?)

\- code completion

\- syntax coloring

\- GUI editor

\- object browser

\- frameworks (jQuery etc)

\- canvas library and GUI

------
skybrian
If you're looking for something like 80's Basic then I recommend trying out
Processing. It has a reasonable IDE and the graphics commands are very
similar.

Processing.js would work too but it needs an IDE.

------
mathgladiator
Where is mode 13 in JavaScript?

