JavaScript, the most popular programming language in the world according to most surveys, has become a barrier to progress, according to Douglas Crockford, creator of the JSON (JavaScript Object Notation) specification used everywhere to serialize data. in web applications.
Crockford made this claim in an interview last month:
“The best thing we can do today with JavaScript is remove it. Twenty years ago, I was one of the few proponents of JavaScript. His improvisation of nested functions and dynamic objects was brilliant. I spent a decade trying to correct its flaws. I had minor success with ES5. But since then, there has been a lot of interest in further bloating the language rather than improving it. So JavaScript, like the other dinosaur languages, has become a barrier to progress. We should focus on the next language, which should be more like E than JavaScript.”
According to a StackOverflow survey conducted earlier this year, JavaScript is used by more than 65% of developers, well ahead of second-place Python at 48% (ignoring HTML, CSS, and SQL, which are non-proprietary languages). general). It is an unlikely achievement considering its origins.
Brendan Eich invented the language for Netscape in 1995, apparently in just 10 days. “In May I worked 10 days hard, I didn’t get much sleep,” Eich said at the dot.JS conference in 2018. In 2012, Eich told Computer’s Charles Severance that: “I went to do… a programming language for HTML, to to be used by web designers and programmers, embedded directly in the web page… not like Java, which was a professional language where you ran real code with type declarations, and had to write it in compiled form.” that “the name is a complete lie. It is not so much related to Java as it is to a common ancestor, C, in syntax.”
Eich called the work “a rush job” but also said that “I knew there would be mistakes, there would be loopholes, so I made it very malleable as a language. That has allowed web developers to make it what they want it to be.”
Why has JavaScript been so successful?
There are multiple reasons, including Eich’s foresight, ease of learning, and tolerance of code that would fail in many languages, such as comparing strings to numbers and getting a common-sense result, though Eich later called this “a great regret, because that breaks an important mathematical property.”
Another important factor is that Google’s determination to make browser-based applications competitive with the desktop gave the world the V8 (2008) engine, which along with Mozilla’s SpiderMonkey and Apple’s JavaScript Core gave the language unparalleled performance. amazing JIT compiled. In 2009, Ryan Dahl came up with Node.js, which allowed V8 to run outside of the browser. Dahl had server-side applications in mind, but today Node.js and NPM (Node Package Manager) are also essential to the development process of most web applications.
Development process? Part of the problem Crockford refers to is that, along with increased capability, JavaScript has become very complex, and a typical application today includes a build process that uses WebPack, Rollup, or some other package, a far cry from the original concept. of Eich.
Also, many web developers don’t write JavaScript; rather, they write TypeScript, which compiles to JavaScript. TypeScript was invented by Anders Hejlsberg at Microsoft, arguing that JavaScript’s malleability and lack of type safety made it unsuitable for large applications. TypeScript is now the number three language in the aforementioned survey, and it’s evidence that JavaScript isn’t quite loved. The arrival of WebAssembly, a binary format that languages like C, C++, C#, and Rust can target, is another innovation that may undermine JavaScript’s dominance.
“JavaScript has exploded in popularity in just a few years and yes, the ecosystem is terribly complex. It’s a running joke, even among full-time JS developers, how crazy it’s gotten. None of us can keep up,” one developer confessed in a recent discussion on Hacker News.
JavaScript is evolving with many new features and progress can be tracked here, although compatibility demands mean that some bugs cannot be fixed, and at the other extreme, function overloading is a constant risk.
Crockford’s choice to replace JavaScript, E, is an outlier. Created by Mark Miller, Crockford, and others, E is an object-oriented language designed for secure computing and, in Crockford’s words, “removing a lot of the bad parts of Java.”
Crockford also points out, however, that JavaScript will be difficult to change, particularly as it is the cross-browser compatible language for Document Object Model (DOM) manipulation. Asked what can replace him there, Crockford said: “There are two difficulties. First of all, we don’t have the next language yet. It should be a capability-based minimal actor language that is designed specifically for secure distributed programming. Nothing less should be considered.
“Second, we need all browser manufacturers to adopt it and simultaneously replace the DOM with a well-designed interface. Good luck with that.”