EssaysForStudent.com - Free Essays, Term Papers & Book Notes
Search

Java Vs Javascript

By:   •  Research Paper  •  2,454 Words  •  November 22, 2009  •  902 Views

Page 1 of 10

Essay title: Java Vs Javascript

Intro

Java and JavaScript share many similarities, but are unique in many more ways. The two languages share similar goals and history, but both serve vastly different purposes. While both are object-oriented languages, Java is an interpreted language while JavaScript is, as its name implies, a scripting language, and not a true programming language. Java is meant mostly to be a multi-tiered language, while JavaScript was written to be a client-side language. While the two languages may look very similar at first glance, a line of code identically written in both languages can produce wildly different results. This is because Java is a strongly-typed language while JavaScript is a loosely-typed language. Both exist to make Web pages more interactive for users, but how they go about doing this and how they work is wildly different.

Java History

Java is an object-oriented program language created by Sun Microsystems in May of 1995. The language was originally part of the “Green Project” which was handled by a staff of thirteen people at Sun known as the “Green Team.” During it's first releases, the language was known as OAK, and it was originally intended to be used for converging devices, which was seen as the next great computing wave. Most of this never saw the light of day, and as the project was about to be scrapped, the Internet took hold in late 1994; the language was almost perfect for this new platform. It was introduced to the world at a SunWorld conference on May 23, 1995, given its new name Java, which came from the drink of choice most of the Java Technology team drank often in order to work the long hours it took to tweak the interpreter to be used for various operating systems and the Netscape Navigator browser.

JavaScript History

While the name would make it seem as though JavaScript is a mere subset of the Java language, this is inaccurate. In fact, the two don't even show the same creators. JavaScript was created by Brendan Eich in early 1996, who was a member of the Netscape Navigator development team (as such, it was part of Netscape Navigator 2). Its original name was LiveWire, and later LiveScript. It closely resembled Java, and because of the close relationship Sun held with Netscape, the name was changed to JavaScript to further push the “Java Technology” in the world of Web development.

The Similarities

Java and JavaScript are both object-oriented languages, as opposed to event-driven languages and modular languages. This affects the thinking and design paradigms a developer must consider when writing code in either. As such, a developer writing code in an object-oriented language such as Java or JavaScript must be adept in abstract thinking, and analytically breaking down the properties of data as detailed as possible.

Both languages debuted as Web programming languages, and both languages exist for the purpose of allowing a user to interact with Web pages. However, both languages are also not limited to Web development; both are widely used outside of Web development. Java has a much broader range of platforms, such as for client-server applications, enterprise middle-tier development, and even in game development. JavaScript also has great success outside of Web development, and the Spider Monkey JavaScript engine built by the Mozilla Foundation is often found in various game engines and development platforms.

Both Java and JavaScript use the same ANSI C style syntax, the most common syntax style used among programming languages. This C-style syntax that both languages are based upon uses such syntax as curly braces beginning and ending methods and loops, variable declarations, and comments, as seen below.

Java JavaScript

/*************************

* Method comments.

*************************/

private void foo(int iP1, String sP2)

{

double dResult = 0;

//Line comment

for (int i = 0; i < 10; i++)

{

dResult = i ^ i % i + 1;

dResult *= dResult;

}

sP2 = dResult.toString();

} /*************************

* Method comments.

*************************/

function

Download as (for upgraded members)  txt (14.7 Kb)   pdf (187.2 Kb)   docx (16.1 Kb)  
Continue for 9 more pages »