Ask HN: Why isn't Javascript the new BASIC?
Why, for heavens sake, has nobody written a decent self-contained JavaScript IDE that we all can use right away?
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.
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).
25 comments
[ 1.8 ms ] story [ 65.5 ms ] threadPeople 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/
There's a lot of value in that simplicity that is still there somewhere but isn't generally accessible for anything "productive" by today's standards.
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.
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 :-)
- upload to provider (google apps? dropbox?)
- code completion
- syntax coloring
- GUI editor
- object browser
- frameworks (jQuery etc)
- canvas library and GUI
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 XX; }
function (X) { return X X; }
f(5)
25
print("Hello, World!")
Hello, World!
Processing.js would work too but it needs an IDE.
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.
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.