There are so many programming languages, why does Google prefer JS?

There are so many programming languages, why does Google prefer JS?

I have been engaged in software development for 15 years. My current work mainly focuses on web and mobile applications. Over the years, my attitude towards JavaScript may be more representative of the views of a large group of programmers: from disdain for JS at the beginning to surprise at its performance and potential in the end.

JavaScript used to be like a toy

In 2000, I also worked on web application development. The development platform was Windows, and Asp was mainly used. At that time, the main purpose of JavaScript was to check whether the data input on the page was correct. When there was an error, a warning window would pop up. At that time, the entire web development and application environment was actually very simple. Web developers probably looked at JavaScript like a toy. Because it can really do very limited things. If you can find IT books about JS in 2000, the content is mostly the same, full of telling you how to use JS to make a ticker, how to create annoying pop-ups, and so on. These contents also further suppressed everyone's expectations for js.

Later, I switched to C/C++ because "real programmers use C++." This switch lasted for many years, and my impression of JS was limited to that little bit of functionality.

In recent years, due to various changes, I have switched back. Looking back at Web development at this time, it can be described as earth-shaking. Related concepts emerge in an endless stream, and various technologies and tools are developed, which are dazzling. What's more, most of this knowledge, except for a few basic categories, is very unstable, and it develops rapidly under this unstable situation, and is eliminated and updated at a crazy speed. The tools you are still using today may be updated and better tomorrow.

Why is this so? Because the hot spots of social needs are here: demand-driven. The life and production of this society have gradually shifted to websites and mobile terminals, which is the main reason for the rapid development and progress in these fields.

Looking back at the toy language of that year: JavaScript, it is no longer what it used to be.

It has grown into an indispensable front-end pillar in the Internet era. It is now unimaginable whether a website can run normally without JS. Not only that, its tentacles have even penetrated into the back-end services, and Node.js is in the ascendant. Some new generation products, such as MongoDB, even have built-in JS language support as a tool for application interaction.

This is something that many people, including me, could not imagine. It forced me to step back and think about why JavaScript has the status it has today.

[[150842]]

The language destined by fate

JavaScript's overall design has highlights, but it also has many problems. It was designed by the author in 10 days. Because of the rush of time, many details were not carefully considered and put on the market, so it was full of loopholes and dross. Douglas Crockford mentioned in "JavaScript: The Good Parts": "The proportion of dross in JavaScript exceeded expectations." (Note: Douglas Crockford, the most well-known authority in the JavaScript development community, is the father of JSON, JSLint, JSMin and ADSafe, and the author of "JavaScript: The Good Parts".)

Even Brendan Eich (creator of JavaScript) himself said: "I hate it more than I love it. It is the product of a one-night stand between C and Self. Dr. Johnson, an 18th-century English writer, said it well: 'the part that is good is not original, and the part that is original is not good.'"

However, it seems to be destined that JavaScript has grasped the direction of future programming languages ​​from the very beginning: functional programming.

"The best thing about JavaScript is its function implementation. It's almost perfect. ... Functions are top-level objects in JavaScript. It's the first Lambada language to become mainstream. It's Lisp in C's clothing."

—— Douglas Crockford

Anyone who has read "Hackers and Painters: The Collected Works of Paul Graham, the Father of Silicon Valley Entrepreneurship" (mainly introduces the hobbies and motivations of hackers, that is, excellent programmers, and discusses topics such as hacker growth, hackers' contributions to the world, and programming languages ​​and hackers' working methods) will remember the author's prediction: Lisp is the ultimate trend of language. (Note: LISP is the abbreviation of list processing LISt Processing. It was created by John McCarthy, a pioneer in artificial intelligence research from MIT in 1958 based on the lambda calculus. It is a general-purpose high-level computer programming language that has long monopolized the application of artificial intelligence and is also the first functional programming language.)

[[150843]]

Paul Graham, the father of Silicon Valley entrepreneurship

Functional programming is gaining popularity

Functional programming is not a new invention. Its history is even older than some mainstream languages. It has been neglected due to performance and implementation issues. Today, computer hardware performance has greatly improved, which has changed many things. Things that were not economical before have become feasible; things that were not good before have become good under new conditions. Given the excellent characteristics and powerful capabilities of functional programming, its popularity is not surprising. The development trend of the application development paradigm of "procedural -> object-oriented -> functional" is foreseeable.

In recent years, scripting languages ​​have become popular. Applications developed with Python/Ruby/PHP instead of static languages ​​are everywhere. Traditional C/C++ applications have gradually been reduced to desktop applications, high-performance server applications, drivers, system interfaces, etc. Because the performance of most applications is no longer a problem, the CPU is relatively surplus, and I/O and network speed are the bottlenecks, because people always pay more attention to development efficiency. JavaScript, because it has such design capabilities from the beginning, has seized the opportunity of technology and followed this wave.

Of course, luck is also indispensable. There are at least hundreds of programming languages ​​in the world. For a language to be recognized and popular, it is not enough to have good technical design, it also needs position and even opportunity.

Programming languages ​​need to find a suitable application field, take root, and expand outward from this base. This time sometimes takes more than 20 years. For example, PHP focuses on Web development, C is indispensable for system development, and Python has many applications in scientific computing and network programming.

In 2004, JavaScript got an opportunity: Google launched Gmail mailbox using Ajax technology, which was comparable to the desktop's seamless experience, causing a sensation in the industry and a wave of imitation. The core of Ajax operation is JavaScript. Since then, JS has become very stable in the browser and has become a de facto standard. In 2009, Node.js based on Google's powerful V8 JS engine appeared, which means that JS has begun to enter other fields and exert its language power. Microsoft also claimed that it could build-in support for JavaScript on the server side, but this is completely incomparable.

JavaScript was the first to meet the needs of the Internet era. The browser was bound to JS scripting technology from the beginning, which gave it a first-mover advantage. After the browser war that year, Microsoft's browser dominated the market. VBScript can be written in IE, but Microsoft's stagnation in the Internet era made it lose many opportunities.

[[150844]]

Due to the low-cost information exchange brought by the Internet and the lower development and deployment costs, more and more products are based on browsers as interfaces. JS is the best choice for application development. The industry has formulated several versions of relevant technical standards to meet the needs. For example, HTML, CSS, and JS all have their own positions and development standards and specifications. They work closely together and integrate into one. Web applications have begun to erode the traditional desktop applications.

Time has proven the value of JavaScript, and it has not been lost in the development of history. As long as there is enough demand in the application field, something that originally had many shortcomings will gain a strong impetus and be transformed into something better.

Brendan Eich made a PPT in May this year, reviewing the creation process of JS language and its development and prospects in the past 20 years. (View address: http://brendaneich.github.io/ModernWeb.tw-2015/ )

I will end with his words:

My advice: always bet on JS.

<<:  In addition to Meizu, there will be more Ubuntu phones on the market

>>:  Fish swimming against the current, the hesitation of a programmer in Beijing about whether to go or stay

Recommend

Mimi Meng, Youshu, Tongdao Dashu, Xin Shixiang... How do they attract fans?

We often say that the biggest difference between ...

New ways to play with WeChat Mini Programs in the wedding industry

The wedding industry is becoming more and more po...

TV games can also be played like this. LeTV game console brings arcade pleasure

Speaking of fighting games, if you tell me that y...

AlphaGo's first bug: What's the Achilles' heel of the Go algorithm?

[[163852]] No matter how terrifying a monster is,...

Short videos + full links, a new way of marketing movies in 2020

2020 was a turbulent year for the film industry. ...

The world's first memristor chip, what breakthrough did the Tsinghua team make?

The wave of development of artificial intelligenc...