Camen Design Forum


(Leave this as-is, it’s a trap!)

To delete this post you must be either the original author or a designated moderator.
The content of the post will be removed but the name and date will remain.

  • The post will be removed completely from the thread, rather than blanked
  • Only posts on the last page of the thread can be removed completely (so as to not break permalinks)

RE[7]: Why isn't JavaScript like BASIC?


Thanks for the great, engaging responses everybody. :)

@eeeps: Calculator programming is something I would have loved to have got into, but those kind of calculators were far too expensive. I would gaze at the different models in the home catalogues, dreaming of the possibilities. Physicality is an important part of the desire to program a device IMO. Calculators lend themselves greatly to this as they have an array of buttons to play with and any kind of computer portability was very special back then; especially in something as small as a calculator.

I briefly used a ZX88 ( in middle school, a device I would have adored to have proper access to to do some programming. The form factor lends to the imagination. The PC has always lacked that imagination-factor IMO.


it's obscured by an avalanche of additional functionality that computers now have.

Not only that, but developing software is no longer considered a primary function of a computer that a consumer wants. Even the venerable task of Word Processing has disappeared and been overtaken by 3GHz 6GB RAM laptops used solely to check Facebook. I don't believe that everybody wants to be a programmer, or even needs to be -- It's a particular mindset IMO -- but I feel it necessary that my child learn, if nothing else, that the computer is a tool that they can put to use to help them in whatever it is they _are_ interested in and therefore they don't have to be beholden to walled gardens and "content-providers".

JavaScript is the next logical step, but it's suddenly no longer so fun and easy.

The pioneers have moved on, the fetishist "pure" programmers have moved in and want to change JavaScript into a "real" programming language. Notice that all the stuff being added to JS now (ES5+6 &c.) practically require a CS degree to understand and don't actually make things _easier_, just more _abstract_. I hate this direction, I hate it with a passion. I want JS to be small, simple and down-right hackish.

It sounds like what you have in mind is a sort of KrocBASIC written with JavaScript. Or is it meant to be more of a simplified JS? [...] It would be cool if it was also a sort of simplified JavaScript, so that it would be a small step leading naturally toward learning to program with JS rather than being just another programming language on its own.

A simplified API (not necessarily "form") of JavaScript is my intention. I could design a new JS-like language and write a script interpreter in JS, sure, but this would only teach the child a lie, a system that doesn't exist in the real world. Something to "un-learn" when one progresses to working with "real" code. I want the child to learn real JavaScript right from the beginning. So it would be actual JavaScript, but with 'shortcuts' to simply certain actions such as generating a canvas and drawing sprites &c. Therefore the code would be real JS, running merely an API library (a lot like jQuery). Later on, the child can learn the real methods behind the 'shortcuts', and phase out the use of the JS-BASIC 'library'.

How will you make JavaScript easier to understand and use?

The core of JavaScript itself is quite easy to learn and use (syntax, strings, arrays, objects). The APIs that tie JS to the browser however can be quite complex, particularly DOM. Some tasks require a lot of code to form a base first, such as sprite manipulation and animation.

What exactly are the rough spots that need smoothing over, and how can it be done without sacrificing too much functionality?

DOM, sprites - particularly animation, sound. The sort of things that one needs to get a game up and running quickly. A big problem with JavaScript is that to write a game -- any game -- one has to start by writing a framework to wrap up a lot of necessary stuff that isn't baked into JS. We need to provide that up front so that a child can start piecing together a game without having to conceptualise and design their own framework first :P

The difference between what I suggest with JS-BASIC and existing frameworks, particularly game ones, is that we are not outright hiding complexity, we will instead provide shortcuts only. Nothing will prevent the programmer from mixing "real" JS with JS-BASIC, so functional holes can be filled in with all the usual JS. JS-BASIC will only provide helper functions that shortcut the needlessly complex APIs in JS, such as audio synthesis.

" In what ways would it be different from any other JS library like JQuery?"

jQuery doesn't simplify difficult programming concepts for children such as OOP, parallelism and browser behaviour. Even with jQuery, you still have to write a framework to get a working game-timer and frame-buffer. We can build those in and make them implicit.

We can actually include jQuery and build off of it. It's a great way of navigating the DOM and we can include some jQuery as part JS-BASIC so that the child can 'get things done' as well as learning some jQuery along the way -- practical and not wasteful knowledge.

What then would be the path from this simplified JS to full-blown JS programming?

As highlighted before, JS-BASIC would be simple shortcuts rather than a replacement for any of JS. One can either use the JS-BASIC command, or do the same thing with several JS commands. Since the child will be learning JS at the same time as using JS-BASIC, this shouldn't be a difficult concept.

The main things that make BASIC (and Python) simple and accessible seem to be *natural language* and a certain *linear logic*.

Yes, it's that linear logic which is the hardest thing to create in JavaScript. It will be hard to create an API that doesn't have to expose too much in the way of anonymous callback functions and event-based programming. If we can handle that behind the scenes, the child will better be able to program in the way they think, in a linear, straight-forward fashion. The task of making JavaScript appear more linear keeps me up at night.

helping to expose the creative power of the browser without burying it under a proprietary, pre-packaged interface is a worthwhile project and I hope this idea will continue to grow.

Thanks. It's great to know there are people out there that understand the concept and the direction of what I'm suggesting.

Your friendly neighbourhood moderators: Kroc, Impressed, Martijn