Downloaded Weighed by Its Ubiquity on All Platforms
Total Page:16
File Type:pdf, Size:1020Kb
Theisen J Cheminform (2019) 11:11 https://doi.org/10.1186/s13321-019-0331-1 Journal of Cheminformatics REVIEW Open Access Programming languages in chemistry: a review of HTML5/JavaScript Kevin J. Theisen* Abstract This is one part of a series of reviews concerning the application of programming languages in chemistry, edited by Dr. Rajarshi Guha. This article reviews the JavaScript technology as it applies to the chemistry discipline. A discussion of the history, scope and technical details of the programming language is presented. Keywords: JavaScript, HTML5, Programming, Chemistry, Cheminformatics, Computational chemistry Introduction essential access to the Internet, and therefore contains a Computer literacy is an essential skill for scientists. Com- web browser wherein JavaScript can be run. As a result, puters can execute the same operations humans can per- JavaScript is one of the most important programming form, but far more consistently and at rates far beyond languages in existence. human capability, allowing researchers to investigate Tis review investigates the relevance and impact of numerous hypotheses in short order. Programmers have JavaScript on the chemistry discipline. We begin by dis- even more advantages, as they can directly communi- cussing the history of the programming language; then cate with the computer to achieve their desired goals, as we investigate the scope and features of the language opposed to relying on software someone else has created and how it applies to chemistry; last, an outline of the for another purpose. technical details of the JavaScript programming lan- Many programming languages have been developed guage is presented to allow those interested in chemis- to facilitate instructions to the computer. Each has its try and cheminformatics to efectively create JavaScript advantages, which is why they each exist. Each program- applications. ming language also has its disadvantages, which is why the rest exist. What is JavaScript? When the Internet was introduced, society quickly JavaScript is a programming language enabling develop- changed, not just in allowing computers to communicate ers to interact with the functionality provided by web with each other, but by allowing people to communicate browsers. More specifcally, JavaScript is a scripting lan- with each other, nearly instantaneously from around the guage, which means (a) traditionally, JavaScript source world. JavaScript (JS) is a programming language born of code is interpreted at runtime and not pre-compiled into the Internet. From a crude and basic programming lan- byte code and (b) practically, its main purpose is to mod- guage for creating cheap, gimmicky efects on web pages, ify the behavior of another application typically written it has developed into a ubiquitous and fexible technol- in a diferent programming language, in which it is inter- ogy where engine performance is regarded as a crown- preted and run in real time. ing achievement among browser developers. Today, While JavaScript is aptly named as a scripting language, every computational device, from desktops to laptops to the frst part of the name misleadingly refers to the Java mobile phones and Augmented Reality (AR) devices has programming language [1]. JavaScript has no functional relationship with the Java programming language. Te *Correspondence: [email protected] Java part of JavaScript was used to inspire interest in iChemLabs, LLC., 7305 Hancock Village Dr #525, Chesterfeld, VA 23112, the new scripting language, as Java was and still is a very USA popular programming language; additionally the original © The Author(s) 2019. This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creat iveco mmons .org/licen ses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The Creative Commons Public Domain Dedication waiver (http://creat iveco mmons .org/ publi cdoma in/zero/1.0/) applies to the data made available in this article, unless otherwise stated. Theisen J Cheminform (2019) 11:11 Page 2 of 19 Netscape browser that included JavaScript was written in provide a more familiar programming syntax for devel- Java. JavaScript has since become an essential and argua- opers and compile into standard JavaScript. bly more important programming language than the one JavaScript has survived many challenges since its incep- inspiring its name. Hence, the programming language tion, and a lot of credit should be given to the Netscape many developers use today to build and interact with web team for their foresight. In order to protect the JavaScript applications is famously known as JavaScript. language early on, the Netscape team pushed for an open standardization of the language, and they were success- Origin ful. We all beneft from the universal and strong support In the early days of the Internet, the web browser pro- for JavaScript in every existing browser today. In spite vided users with static pages to view information. Inno- of the attempts to replace or commandeer the standard, vators at Netscape Communications, producers of the JavaScript persisted and has become a signature pro- popular Netscape Navigator browser, believed web gramming language for most developers, and remains an sites should provide more dynamic material and a pro- important tool for the scientifc communities including gramming language would provide a solution. In 1995, chemists. Brendan Eich, an employee of Netscape Communica- tions, developed what is now known as JavaScript [2]. ECMAScript Initially, JavaScript only provided basic features, but Te European Computer Manufacturers Association, the power of such a programming language on the now known as Ecma International [9], took over the web was quickly realized, and the continued success of governance and standardization of JavaScript in 1996 Netscape Navigator was, in no small part, a refection of and continues to maintain the specifcation for the lan- that power. Alternatives to JavaScript were inevitable and guage to this day. Te JavaScript specifcation is ofcially a number of companies started to produce more feature- named ECMAScript, defned by the ECMA-262 standard rich browser plug-ins that would install their platforms published by Ecma International [10]. So paradoxically, into browsers to be run in web pages. Adobe Flash [3], JavaScript led to the development of the ECMAScript Java applets [4] and Microsoft Silverlight [5] are a few standard that now governs the development of JavaScript. well known examples. Tese plug-ins became popu- JavaScript also contains functionality to access technol- lar solutions for developers, but a hindrance for users ogy standards not governed by Ecma International, such as plug-ins required installations, had to be frequently as HTML5 <canvas> [11] and Web Graphics Library updated, and were prone to security issues. Plug-ins (WebGL) [12] for 2D and 3D graphics in webpages. eventually fell out of favor with users as HTML5 arrived JavaScript is not the only implementation of ECMAS- and JavaScript evolved. Flash, Java applets and Silverlight cript. Due to the large number of developers pro- are all now deprecated technologies. gramming in JavaScript (and therefore ECMAScript), Other companies, instead of replacing JavaScript, ECMAScript has been used as the framework to develop attempted to modify and extend the language in an other, non-browser-based technologies. Node.js [13] attempt to control it (a process known as “embrace, compiles ECMAScript for server systems. ActionScript extend and extinguish”). In 1996, Microsoft produced [14] was an Adobe implementation of ECMAScript JScript [6], which was a reverse engineered version of providing scripting functionality to the now deprecated JavaScript for their Internet Explorer (IE) browser. IE Adobe Flash Player platform. Rhino [15] and its replace- would now be accessible to JavaScript developers, but the ment Nashorn engine [16], provide Java based ECMAS- implementation was deceitful. Proprietary features spe- cript scripting environments in Java applications. Te cifc to IE were built into JScript. As a result, users were multitude of ECMAScript implementations causes forced to use IE for many online applications, imped- confusion as many engines based on ECMAScript are ing the open web in a process known as fragmentation. described as providing a JavaScript environment in their Fragmentation produces an anti-competitive, positive particular platform. Tis is false and due to name recog- feedback loop giving a dominant group (in this case, nition. JavaScript is strictly the web based implementa- the dominant browser, IE) power over the future direc- tion of ECMAScript for internet browser engines. tion of the Internet. Tese attempts ultimately failed While ECMAScript certainly has a range of utility and due to healthy competition amongst browser develop- implementation across a variety of platforms, this review ers. Microsoft browsers now aim to legitimately support focuses on the JavaScript implementation of ECMAS- JavaScript. Creative methods for fragmenting the JavaS- cript as it applies to client side HTML5. cript language continue to exist with TypeScript from Microsoft [7] and Dart from Google [8], which aim to Theisen J Cheminform (2019) 11:11 Page 3 of 19 HTML5 to learn syntax