Every single developer and architect has their language of choice, whether its Fortran, A, B, C, C++, C#, Python, Java, JavaScript or any of the countless languages developed by numerous individuals and companies. They all offer advantages and disadvantages for various business needs which, today, must be taken into account when architecting an application.

What about the future of coding languages — where is it headed? Will a future universal language (or comprehensive sequence of languages) dismantle what’s in the world today? Or will existing languages blend into one? To answer these questions, I’ll first briefly describe the history of the fastest growing languages today — Java and JavaScript. Secondly, I’ll contrast the two languages from a technical perspective. Lastly, I’ll put forth my argument for JavaScript overtaking Java and, crazily enough, potentially becoming a part of a universal sequence of languages.

The History

In 1995, Java — marketed as “a language without boundaries” — left the labs at Sun Microsystems and took the world by storm with its object-oriented design that merged information and programming to make surfing the Web a more dynamic experience. When James Gosling, the Father of Java, demoed a virtual molecule flying across the screen when hovering his mouse over it within the Java-based WebRunner browser, the vision of the dynamic Web was put at the forefront of everyone’s mind. In essence, a revolution began.

Mocha — ironically, one of the original development names for JavaScript — was created in the same year by Brandon Eich and Netscape and released closely on the heels of Java. JavaScript was initially and officially known as LiveScript. It was not seen as a competitor but as a complementary scripting language after a license agreement between Sun and NetScape was signed which renamed LiveScript to JavaScript.

Over the years, both languages grew significantly in adoption, functionality, and community. Library after library and framework after framework, Java grew immensely connecting everything from the Java source code to the Java Virtual Machine (JVM) bytecode to the computer’s operating system. JavaScript, for most of its history, was only utilized on the front-end side of web development gaining even more popularity with jQuery but creating a new upheaval with the advent of a new backend technology — Node.js.

Technical Comparison

Java and JavaScript are like comparing a ham to a hamster. They are vastly different languages using disparate syntaxes, execution lanes, inheritance types, and much, much more. Some differences are outlined below:

Java (Programming Language)

  • Class-based inheritance: Define classes for objects instead of the objects themselves. These classes are then extended to other classes. Objects are instances of these classes.
  • Compiled language: Machine-language instructions are generated from the source code. The code has already been translated instead of needing to “interpret” or translate it on the fly.
  • Thread-based concurrency: Divides work up in the hardware. Because each piece of work has its thread, and will block if it needs to (like when it’s waiting for IO), the CPU will suspend that thread and start running another that is waiting. Every time that happens there is quite a hefty context switch, including moving about 2MB of data around.
  • Static typed: The type of a variable is known at compile time which leads to machine and error handling optimizations.
  • Tautological: Java is verbose in where the same words are often used to define variables and other structures.

JavaScript (Scripting Language)

  • Prototype-based inheritance: Define an object which is then extended to other objects. E.g., fruit object is extended to a banana object where the banana object has additional properties specific to the banana.
  • Interpreted language: Execute instructions directly and freely, without previously compiling a program into machine-language instructions.
  • Event-based concurrency: Divide work up using callbacks, an event loop, and a queue. It is non-blocking, so there is always something running on the thread. Note: There is experimental multi-threading support with Node v10 which directly competes with Java’s thread-based concurrency.
  • Dynamically typed: The type is associated with runtime values and not named variables, fields, etc. The use of TypeScript changes this.
  • Laconic: Since JavaScript is dynamically typed, code initialization and definition is succinct often quickening development time.

In many ways, you could say Java and JavaScript are opposites. Even the Java Virtual Machine (JVM) is an alternate concept to a universal language in fixing the problem of many languages prevalent in the development world today. Instead of a universal language, the JVM is trying to provide intake for all languages and being able to translate those languages into machine-language instructions.

The Vision

With the technical comparison aside, imagine a world where there was only one high-level programming language. Depending on your personality or bias, you may envision a scary or beautiful world. On the negative side, you might be envisioning skyrocketing unemployment rates because businesses only need one type of programmer, questioning how in the world does that get interpreted by the machine or non-performant applications based on business need. On the positive side, you might be relieved from learning new languages on a seemingly daily basis, proclaiming quicker feature creation especially in this fast-paced world we live in, or pondering the optimization of code based off a broader community of contributors.

It’s silly to think that could happen, or is it? Let’s take a step back and see how an isomorphic, universal language would benefit business, the developer and user experience, and society as a whole.

Client Side

Libraries like React.js and React Native — which use JavaScript — implement a component-based design of web applications to render elements to the screen. Depending on your coding proficiency and your application’s architecture, the modularity that comes naturally with React can add the benefits of loosely coupled, highly cohesive, flattened, and scalable code.

An entire web application can be written in pure JavaScript. As for styles written with Cascading Style Sheets (CSS)? Well, those can be handled with CSS-in-JS libraries such as jss, styled-components, and aphrodite — all written in JavaScript.

And why couldn’t a web browser be created that interprets purely one language instead of three? Or a program like Tableau be optimized to use that one universal language? After all, it all starts with the hardware.

Data Transfer

While not JavaScript, JavaScript Object Notation (JSON) corresponds in form and relation to JavaScript syntax with a subset of JavaScript literals keeping it in line with the isomorphic design. It is quickly becoming the data format of choice for APIs and database storing, if not already.

Server Side

If it weren’t for Node.js, this article wouldn’t have been written. Node.js is a server-side framework written in JavaScript and built upon Google’s V8 Engine that is written in C++ much like the core functionality of Google’s Chrome browser is written in C++. A universal sequence of languages from machine language to high-level languages could be Machine Code → Assembly (optional) → C++ (sorry, Linux developers) → JavaScript.

Standalone Applications

For those individuals and companies needing an application unattached to the web browser, Electron.js is gaining traction for standalone applications written in web languages (HTML/CSS/JavaScript). In many ways, I think this was the vision for Google’s Chrome OS and its Chrome Apps.

Business Advantage

Whether you’re an individual starting the next big startup or an employee working in a Fortune 50 enterprise, developers writing in one language helps on so many different accounts from recruiting and onboarding to team collaboration to quicker deployments, more seamless experience for both the developer and consumer, and the costs for development overall.

Conclusion

In conclusion, the programming world has a real problem. The nature of the business was once monolithic and siloed where languages were created for a particular purpose. Instead, the development of a sequence of languages from the low-level to the high-level should have occurred. A broader community would then optimize those sequence of languages alongside the optimization of hardware. A modular language sequence with import ability for libraries optimized for whatever hardware the code is ultimately executed on is optimal.

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *