Naked JavaScript

Taking the DOM off JavaScript 
 
Filed under

quickstart

 

Getting Started

Before beginning, we should make sure that we are all here for the right reasons. JavaScript is commonly only thought of as a scripting language confined the browser space and riddled with "landmines". Both statements, as we shall see throughout this series, are completely false descriptions of the language and its the intention of these posts to change your view. So that is our goal, to learn the wonders, beauty, and a little bit of magic that you can accomplish with a language that you will use or at least could be using in nearly every project with little effort. 

I could go on to laud about how elegant and beautiful JavaScript is, but that really doesn't help anyone. At this point I am going to assume you have some degree of interest in the language and have been exposed to at least one other programming language. A final "clarification", in order to expedite these posts to you, I am going to limit the operating system environment to Mac OS X and Linux. If you are a reader using a Windows machine, all of the examples after installation should work perfectly. Please leave a comment with any notes on how to accomplish the same installation results in Windows if there are any differences and we will add them as part of procedures.

Without further ado, lets get JavaScripting.

Getting JavaScript

Unlike other programming texts you might be familiar with, the "configuration step" before we get to "Hello World" is going to be rather long. The length of this post is mainly because we are going to set up the full spectrum of JavaScript interpreters. For the first examples we will be going through, you will not need all of the JavaScript interpreters, so if you want to "Quick Start", just follow the instructions for Rhino. We will be using all of these interpreters as part of the series, mainly because the projects that use them take advantage of specific features each offers. I recommend pulling down all of them and playing around with each, it will be quite exciting. Each post will begin with an identifier of which JavaScript engine can be used for that particular example as well as a link to install that engine, so if you want you can install the engine only when needed.

The following are the interpreters we will be installing and using as part of this series:

  • Rhino - A Java based JavaScript engine from Mozilla this is probably the most widely deployed and used non-browser JavaScript interpreter available. As such it is also the easiest to begin playing with Naked JavaScript in and the most robust base implementation. That said, the newer implementations mentioned below are pushing the envelope in terms of what JavaScript can do. They provide new features (Web Workers, etc.) that Rhino has yet to implement. If you are looking for the quickest, most risk-free start, Rhino is your best bet.
  • SpiderMonkey - A C based JavaScript engine from Mozilla. This interpreter is the main JavaScript engine that has been used in Mozilla products, including Firefox, up until version 3.5 which will include a revised interpreter named TraceMonkey.
  • TraceMonkey - A massive extension of SpiderMonkey that leverages the power of Trace Trees for Just In Time (JIT) native code compilation process which in turn drastically improves performance on the order of 3 to 30 times. TraceMonkey includes various improvements to the overall processing and handling of JavaScript as well as integrating the newest features including better garbage collection and various integrations from the Tamarin project, an open source ActionScript Virtual Machine built as a collaboration between Mozilla and Adobe.
  • V8 - A C++ based JavaScript engine built by Google as part of the Google Chrome web browser. Google's team openly focuses on making V8 a high performance engine by applying deep virtual machine technology to the entire workflow of JavaScript interpretation and processing. Google developed V8 for a variety of reasons, but mainly because of a firm belief that high performance JavaScript engines are critical for future innovations
  • SquirrelFish Extreme - Also known as JavaScriptCore, WebKit's JavaScript engine which was one of the first "performance" contender's to Mozilla's general dominance. Apple uses WebKit and JavaScriptCore to produce Safari, their lightning fast web browser for both desktop and mobile web browsing. Mobile Safari for the iPhone brought full featured mobile web browsing to the general public and was the first time that a vender recommended the creation of pure HTML, CSS, and JavaScript for application development. Palm went a step further with WebKit as part of building the Palm Pre by using HTML, CSS, and JavaScript throughout the entire Operating System stack and their Mojo SDK.

There are other JavaScript engines out there, but for the sake of discussions in this series, these will be the main engines that we use. The next several posts will help you with install each engine. It is recommended that in order to keep them all straight you create a directory named "javascript", without the quotes. While you can put this directory anywhere, the examples will assume the directory is off of your home directory. To create this directory enter the following commands:

  mkdir ~/javascript && cd ~/javascript 

And you are off to installing.

Filed under  //   javascript   js   quickstart   rhino   squirrelfishextreme   tamarin   tracemonkey   v8   webkit  

Comments [0]