Uses
As an advanced programming language, Java powers many applications, both big and small, from apps on an Android or iPhone, to Blu-Ray players, to games like Minecraft.
JavaScript is best known for its use in web design. Most often, it is the language behind subtle graphical animations, very simple games, creative transitions, and alert messages on a webpage. JavaScript is also used to call other scripts from around the web, such as an advertising script from Google or a social media "widget" from Twitter or Facebook.
While JavaScript started as a "front-end" scripting language for web pages, it is becoming increasingly popular for server-side programming via NodeJS. Recent advances in JavaScript (ECMAScript) have also taken the language toward a more object-oriented paradigm.
For Websites
JavaScript is commonly found in "front-end" applications, i.e., the web pages delivered to users' browsers. With node.js, JavaScript can also be used to build "back-end" or server-side applications.
Conversely, Java is more commonly used for back-end, server-side processing. Java applets may be used for browser-based apps, but they require a Java plugin and cannot run natively in web browsers.
For Desktop Applications
Beginning in the late 1990s, Java was the programming language of choice for desktop applications because it offered cross-platform support. This means application developers could write their programs in Java and they would run on Windows, Mac, and Linux desktops without needing any changes.
Mobile Applications
Native Android apps are written in Java, and older smartphone platforms like Symbian and Bada also support Java. Mobile apps can also be written in JavaScript, but there are usually a few limitations:
- Third party tools like Titanium Appcelerator or Phonegap are required to convert the JavaScript code into the respective native code that the mobile platform can execute.
- The look and feel of a mobile app written in JavaScript is often dissimilar to what native code may produce.
- Not all functionality offered by a smartphone can be utilized by JavaScript apps. Certain features like checking battery life are only available to native code.
The potential advantage of using JavaScript for mobile apps is being able to reuse a greater percentage of the code base across mobile platforms.
Embedded Systems
Java is a mature, stable technology platform and can often be found in embedded systems, usually running on an underlying Linux OS.
Learning
Because Java and JavaScript have extensive documentation and active online communities, learning either language should be free and relatively straightforward. Still, Java has a steep learning curve, while JavaScript will likely seem easier to start with because of how it functions in a web browser. If you want to build applications, you should learn Java. If you want to make websites, you should learn JavaScript.
You can begin learning Java for free with the website Learn Java. This video also offers a brief tutorial on Java:
Codecademy offers free walkthrough tutorials for JavaScript and one of its most popular libraries, jQuery.
The following is a JavaScript tutorial video:
Syntax
Java's syntax is similar to C and C++'s. It has no global variables or functions. Code is contained in classes, and values are objects.
The following code prints—displays—the words "Hello, World!" on a webpage.
class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); // Display hello. } }
JavaScript's syntax is also influenced by C, and naming conventions are similar to those found in Java.
The following code displays a dialogue box with the words "Hello, World!" inside it.
<script> alert('Hello, World!'); <script>
Popular Frameworks and Libraries
In modern design and development, Java and JavaScript are often "filtered" through frameworks and libraries, which are development tools that simplify programming. The difference between a framework and a library is contested, with the terms sometimes used interchangeably, but the easiest way to differentiate the two is to know that a framework provides a "skeleton" system to work from, while a library provides specific tools to build upon a system.
Some of Java's most popular frameworks include Spring MVC, JSF, Struts, GWT, and Play.
JavaScript has a number of popular libraries, including jQuery and jQuery UI, Prototype, Mootools, and Node.js.
Java vs JavaScript popularity
In a way both Java and JavaScript promise multi-platform support — Java because its JVM is available for a lot of operating systems, and JavaScript because web browsers are available to users of all operating systems. So it is no surprise that both JavaScript and Java are very popular among developers.
Nevertheless JavaScript has seen a surge in popularity over the last 5 years and is now the most popular language on GitHub, whether measured by number of projects or number of pull requests.[1][2]
Support
For users, all modern operating systems support Java (usually through Oracle), and all modern browsers support JavaScript. For web developers, creating scripts in JavaScript will be straightforward, while creating online Java applications will be trickier, and not only because of the difficult nature of the language itself. Few shared web hosts will host Java applications due to how much memory they tend to use on a server. Because of this downside to Java, other languages, like PHP, Ruby and Python, continue to be more popular for web development purposes, even though they are often slower in other ways.
Licensing
As languages, neither Java nor JavaScript is inherently open source, but many implementations, or uses, of the languages are open. In other words, editing the actual, core structure of the languages may be managed and standardized by official standards and specifications, but making use of the languages will be free for most projects.
History and Influences
Java was created by Sun Microsystems in 1991. Developers intended for Java to be used in interactive television, but this did not come to fruition. Instead, a public implementation of Java was released in 1995 for use in computers and web browsers. Eleven years later, in 2006, Sun became committed to a more open standard for Java, releasing parts of the language under an open-source GNU license.
Since the Oracle Corporation acquired Sun Microsystems in 2009, this standard has remained. However, Oracle has been more dogged in its efforts to chase after companies and developers who have failed to have their Java works approved. This was at the core of a heated 2012 court case, Oracle v. Google.
Meanwhile, JavaScript—originally known as Mocha—was developed by Netscape in 1995. Intended to be a user-friendly, lightweight companion to Java, JavaScript was first introduced to users through Netscape's web browser, Netscape Navigator. Following this, Microsoft developed a competing language, JScript, while JavaScript's developers sought support and standardization for their language. This was achieved in 1996 when the ECMA took control of JavaScript's development, which helped pave the way for international support and adoption in all web browsers. Technically, the language should be called ECMAScript, but most still know it by its original name of JavaScript.
References
ncG1vNJzZmivp6x7pbXFn5ynZpOkunCwyJ%2BdnqqVo7Cme6marZqXVWeFsb7OoKmapZ2eu6iry5qloK2RnLJmfpiYrayXepbDop%2FCq6CprA%3D%3D