Wednesday, October 16, 2013

Java is to JavaScript as Car is to Carpet - a Beginner's Guide

Some recent discussions at work have led me to the surprising realization that lots of people working in IT don't understand that Java and JavaScript are almost completely unrelated to each other. This is actually a fairly important misunderstanding to correct:  it leads to wasted troubleshooting efforts, such as downgrading or upgrading Windows Java installations in response to browser JavaScript errors.

I found the title of this blog entry in a StackOverflow post: "Java is to JavaScript as Car is to Carpet". That's pretty much it, in a nutshell. For the record, the only things that Java and JavaScript have in common are:
  1. They are both programming languages.
  2. The word "Java".
  3. Both came out of the web technology explosion of the early 1990s.
  4. Both are frequently encountered in the context of web browsers.
Java is a compiled programming language that was originally developed with a major goal of allowing similar or identical codebases to run on different platforms without needing to be recompiled. It does this by compiling to "bytecode" rather than platform-specific machine code, which then typically runs inside a so-called "Java Virtual Machine". Java was originally developed and controlled by Sun Microsystems (now Oracle), but it has since been re-licensed under the GNU Public License. Numerous open-source Java implementations now exist, but the Oracle/Sun version is still the most familiar to the average user.

Java is associated with the web browser experience because of the widespread use of Java "applets" that are embedded in browser windows. Applets are not technically part of the browser; the compiled Java bytecode is downloaded by the browser and executed in a Java Virtual Machine (JVM) as a separate process. Applets are frequently transferred as a compressed "Java archive", or JAR file. Applets downloaded by a browser do not necessarily need to run in a browser window, but the fact that they are frequently embedded there leads to some confusion.

Neither is Java necessarily a client-side technology: many popular server-side applications are written in Java and execute in a server-side JVM. Google's Android platform extends things even further, using Java as the programming language but compiling the bytecode to execute on their own proprietary virtual machine.

JavaScript, on the other hand, is an interpreted (i.e., non-compiled) programming language that was originally developed to run inside web browsers. It was developed at Netscape and was later adopted by Microsoft and standardized as "ECMAScript". The use of "Java" in the name "JavaScript" was probably an attempt to piggyback on the popularity of Java; the two languages have almost nothing in common from a technical perspective.

JavaScript is most frequently used to control the web browser experience, but there are many projects that use JavaScript completely outside the browser. My first experience with this dates back to the late 1990s, when I used a JavaScript-based commercial tool to automate software deployments to Windows workstations. Today, there are many interesting non-browser-embedded JavaScript platforms, such as Node.js and PhantomJS.

13 comments:

myName said...

Nice post. Thanks for sharing, I knew the difference already but I was still asking myself how the names ended up sharing the word Java.

Unknown said...

They are both programming languages.

Actually, since JavaScript code doesn't need to be compiled in order to run, it's considered to be a scripting language, rather than a programming language.

Melbourne Web Developer said...

I am very much pleased with the topic you have chose for. I enjoyed every little bit part of it.

lettyharry said...

It is worthwhile reading this blog. I was searching such kind of blog for a long time but now I think I got a blog of my interest. I am thankful for these all suggestions mentioned under this blog.
Pepperstone Forex โกง

Blog Comment Backlinks said...

Fantastic blog you have here. You’ll discover me looking at your stuff often. Saved! The Top Cleaner

Praylin S said...

I am really glad that I came across your blog. This blog is worth reading. I am new to Java, but still, I was able to understand the concepts. Keep updating. This'll be of great help to me. Regards.
Javascript Training in Chennai | Javascript Training Classes | Javascript Course in Chennai | Javascript Training

Calla said...

Found your post interesting to read. I can't wait to see your post soon. Good Luck for the upcoming update. This article is really very interesting and effective.
php training institute in Mumbai

Vicky Ram said...

Keep sharing this kind of worthy information. I really enjoyed reading your article.

Article submission sites
Technology

Anbarasan14 said...

This was an well written blog. The admin has really shared a very useful content in a clear way. Thanks for sharing.

IELTS Classes in T Nagar
IELTS Coaching In Velachery
IELTS Coaching in Tambaram
Spoken English Classes in Chennai
Best Spoken English Classes in Chennai
English Speaking Classes in Mumbai
IELTS Coaching in Chennai
IELTS Classes in Mumbai

Sam said...

i hope you have prepared yourself for the upcoming time! the time when you'll find yourself in a place where every blogger have dreamed for if you want professional Web designing services then please visit us

Village Talkies said...

Thanks for sharing
Village Talkies a top-quality professional corporate video production company in Bangalore and also best explainer video company in Bangalore & animation video makers in Bangalore, Chennai, India & Maryland, Baltimore, USA provides Corporate & Brand films, Promotional, Marketing videos & Training videos, Product demo videos, Employee videos, Product video explainers, eLearning videos, 2d Animation, 3d Animation, Motion Graphics, Whiteboard Explainer videos Client Testimonial Videos, Video Presentation and more for all start-ups, industries, and corporate companies. From scripting to corporate video production services, explainer & 3d, 2d animation video production , our solutions are customized to your budget, timeline, and to meet the company goals and objectives.
As a best video production company in Bangalore, we produce quality and creative videos to our clients.

Aishwariya said...

wonderful article contains lot of valuable information. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.
AWS certification course in Chennai

Aatif Anjum said...
This comment has been removed by the author.