博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
为什么JavaScript是未来的编程语言
阅读量:2520 次
发布时间:2019-05-11

本文共 8938 字,大约阅读时间需要 29 分钟。

JavaScript was the first programming language I picked up. Well, I actually started with HTML and CSS. Just like many other web developers, going with JavaScript was a no-brainer. This is simply because it blends so well with HTML and CSS, and actually enhances your HTML/CSS skills as well. I've developed applications and games in various other programming languages including Java, Swift, C++, Dart. But the flexibility which JavaScript provides is unmatchable - even though it could be considered bad for beginners as it gives way more options than required to do a simple task.

JavaScript是我学习的第一门编程语言。 好吧,我实际上是从HTML和CSS开始的。 就像许多其他Web开发人员一样,使用JavaScript也很容易。 这仅仅是因为它与HTML和CSS很好地融合在一起,并且实际上还增强了您HTML / CSS技能。 我已经使用其他各种编程语言(包括Java,Swift,C ++,Dart)开发了应用程序和游戏。 但是JavaScript提供的灵活性是无与伦比的-尽管对于初学者来说,它可能会带来坏处,因为它提供了比完成简单任务所需的更多选择。

Today, JavaScript is one of the most powerful languages on the planet because of its performance and omnipresence.

如今,由于JavaScript的性能和无所不在,它已成为地球上功能最强大的语言之一。

Personally, I feel like JavaScript has the potential to tap into so many popular industries like Machine Learning and Data Analysis, where Python still rules the game. It's even happening now with tools like Tensorflow.js!

就我个人而言,我觉得JavaScript有潜力利用诸如机器学习和数据分析之类的众多热门行业,而Python仍在这些行业中统治游戏。 现在甚至使用Tensorflow.js之类的工具正在发生这种情况!

However this was definitely not the case for JavaScript before. Earlier, it was a weak, non-performant language and was frowned upon. JavaScript was for "losers".

但是,JavaScript绝对不是这种情况。 较早之前,它是一种较弱的,性能不佳的语言,因此被人们所拒绝。 JavaScript是针对“失败者”的。

But not anymore. Let's see how JavaScript turned the tables in the last 10 years, why it has become stronger than ever, and why it is here to stay.

但现在不再。 让我们看看JavaScript在过去10年中是如何扭转局面的,为什么它变得比以往任何时候都强大,以及为什么它会持续存在。

V8:支持JavaScript的野兽 (V8: The beast powering JavaScript)

V8 is actually a JavaScript engine. What is a JavaScript engine, you might ask? A JavaScript engine is an interpreter which executes JavaScript code. A JavaScript engine can be implemented as a standard interpreter, or just-in-time (JIT) compiler that compiles JavaScript to bytecode in some form.

V8实际上是一个JavaScript引擎。 您可能会问,什么是JavaScript引擎? JavaScript引擎是执行JavaScript代码的解释器。 JavaScript引擎可以实现为标准解释器或实时(JIT)编译器,该编译器将JavaScript编译为某种形式的字节码。

V8 is Google’s open source high-performance JavaScript and WebAssembly JIT engine, written in C++. It is used in Chrome and in Node.js, among others. V8 can run standalone, or can be embedded into any C++ application.

V8是用C ++编写的Google开源高性能JavaScript和WebAssembly JIT引擎。 它用于Chrome和Node.js等。 V8可以独立运行,也可以嵌入到任何C ++应用程序中。

This is the piece of software which highly optimizes your JS code and converts it into machine code for the CPU to execute. Some of the tasks V8 handles are:

这是一款可以高度优化您的JS代码并将其转换为计算机代码以供CPU执行的软件。 V8处理的一些任务是:

  1. Garbage Collection

    垃圾收集
  2. Compilation to Machine code

    编译机器码
  3. Inline caching

    内联缓存
  4. Pointer compression

    指针压缩
  5. and much much more optimization

    还有更多优化

As a matter of fact, pointer compression is a very new technique in V8 to boost memory optimization while having no effect on performance. If you're a geek, you can read more about how it is implemented on the official V8 blog.

实际上,指针压缩是V8中的一项非常新的技术,可以在不影响性能的情况下提高内存优化。 如果您是极客,则可以在官方V8博客上阅读有关其实现方式的更多信息。

The takeaway from this is that you can write JavaScript and sleep tight at night because your JS code is in very good hands.

这样做的好处是,您可以编写JavaScript并在晚上睡个好觉,因为您的JS代码掌握得很好。

成熟的生态系统和社区 (Mature ecosystem and community)

JavaScript has one of the most mature – if not THE most mature – ecosystems a programming language could ever have. The community for JavaScript is vast, and the entry barrier is extremely low.

JavaScript具有一种编程语言可能拥有的最成熟的(甚至不是最成熟的)生态系统之一。 JavaScript社区非常广泛,入门门槛非常低。

You can fire up a browser (found on 100% of personal computers), open the console, and you'll find a JS engine waiting for you to run code! This was never the case with any other programming languages of such complexity.

您可以启动一个浏览器(在100%的个人计算机上使用),打开控制台,您会发现一个JS引擎在等您运行代码! 如此复杂的任何其他编程语言都绝不会出现这种情况。

As if the vast community wasn't enough, we have the npm and yarn package systems. You name it and there's a package for that on the npm registry – everything from creating random strings to handling streams and buffers in JavaScript. There's a very famous saying among JavaScript developers:

好像广大社区还不够,我们拥有npmyarn包系统。 命名后, npm注册表中就有一个用于打包的软件包–从创建随机字符串到处理JavaScript中的流和缓冲区的所有内容。 JavaScript开发人员中有句非常著名的话:

What can be done in JavaScript, would eventually be done in JavaScript
用JavaScript可以完成的工作,最终将用JavaScript完成

It's funny, but lowkey, I believe this.

这很有趣,但是低调,我相信这一点。

If you enter as a beginner, there is very little chance you encounter a problem which nobody has encountered before. This is because all possible mistakes for simple JavaScript issues have probably already been asked about and archived on sites like Stack Overflow.

如果您是初学者,那么几乎没有人遇到过任何问题。 这是因为所有有关简单JavaScript问题的可能错误都已经被问到并存储在Stack Overflow之类的网站上。

Frameworks and libraries like React, Angular, and Vue are paving the way for how future applications should be built. They're shifting the perspective towards declarative instead of imperative programming, the what instead of how. This lets developers develop quality applications without worrying about underlying high performant code.

React,Angular和Vue等框架和库为将来的应用程序构建方式铺平了道路。 他们正在将目光转向声明式而不是命令式编程,而不是如何。 这使开发人员可以开发高质量的应用程序,而不必担心底层的高性能代码。

无所不在 (Omnipresence)

JavaScript is present on:

JavaScript存在于:

  1. Front end (Browsers)

    前端(浏览器)
  2. Back end (Node, Deno)

    后端(节点,Deno)
  3. Android/iOS (React Native, NativeScript, etc.)

    Android / iOS(React Native,NativeScript等)
  4. Desktop (Electron)

    台式机(电子)
  5. Hybrid (Ionic)

    混合动力(离子)

What makes this possible? JS engines like V8 are written in C/C++ and can even be compiled on embedded systems! For other platforms, because browsers are always present (like on Andorid/iOS), they ship with a JS engine which can then be used to run any JS code, even for native apps in the case of React Native.

是什么使这成为可能? 像V8这样的JS引擎是用C / C ++编写的,甚至可以在嵌入式系统上进行编译! 对于其他平台,由于浏览器始终存在(例如在Andorid / iOS上),因此它们附带有JS引擎,然后可以使用该JS引擎运行任何JS代码,即使是本机应用程序(对于React Native)。

出血特征和进步 (Bleeding edge features and advancement)

JavaScript standards are led by the ECMA-262 TC39 community, and wow are these people fast! ECMAScript releases a new standard of JavaScript every single year (see the new ECMAScript2020 features!). You as a developer can even request that new features be added to the language.

JavaScript标准是由ECMA-262 TC39社区领导的,这些人真是太快了! ECMAScript每年都会发布JavaScript的新标准(请参阅ECMAScript2020的新功能!)。 您作为开发人员甚至可以要求将新功能添加到该语言中。

For instance, here are some pending bleeding edge features which might make it into JavaScript in the near future:

例如,以下是一些尚待解决的尖端功能,它们可能会在不久的将来成为JavaScript:

You can find all the proposals here: .

您可以在此处找到所有建议: 。

JavaScript快速且可扩展 (JavaScript is FAST and SCALABLE)

Of course, nothing really beats C/C++/Rust, but JavaScript is a fast - in the sense that V8 can generate highly optimized code by monitoring how your code executes, delaying the bits of execution which are not used, and optimizing the code segments which are used over and over. Especially when compared to its nearest competitors like Python. With the advancements in V8, it is becoming even more performant and memory efficient.

当然,没有什么比C / C ++ / Rust更胜一筹了,但是JavaScript是一种快速的方法-从某种意义上说,V8可以通过监视代码的执行方式,延迟未使用的执行位并优化代码段来生成高度优化的代码。一遍又一遍地使用。 特别是与最接近的竞争对手(例如Python)相比。 随着V8的进步,其性能和存储效率越来越高。

JavaScript (Node) is highly scalable (with supersets like TypeScript). Running on a single threaded architecture, people often criticize Node for its lack of threading environment, but the reality is it doesn't matter a lot.

JavaScript(节点)具有高度可扩展性(具有TypeScript等超集)。 在单线程体系结构上运行时,人们经常批评Node缺少线程环境,但实际上这并不重要。

The way you scale Node applications is not similar to how you'd scale a multi-threaded application. Node literally means "node" - a single node in a tree of processes. Node is scaled by running multiple instances of it and managing the cluster.

扩展Node应用程序的方式与扩展多线程应用程序的方式不同。 节点字面意思是“节点”-进程树中的单个节点。 通过运行节点的多个实例并管理集群来扩展节点。

JavaScript leads the asynchronous event driven programming model of the industry, and does not need threads to scale. Instead, individual Node processes could be spawned to handle and utilize the complete CPU core. More on scaling Node later!

JavaScript引领业界异步事件驱动的编程模型,并且不需要线程即可扩展。 相反,可以生成单个Node进程来处理和利用完整的CPU内核。 稍后会详细介绍如何扩展Node!

结论 (Conclusion)

I love JavaScript, and using it I've created a developer platform for developers like you. There you can not only learn JavaScript, but also various other languages like C, C++, Java, Node, Python, and more! and learn with other developers straight outta your browser!

我喜欢JavaScript,并使用它为像您这样的开发人员创建了一个开发人员平台。 在这里,您不仅可以学习JavaScript,还可以学习其他各种语言,例如C,C ++,Java,Node,Python等! 与其他开发人员一起直接在浏览器中学习!

JavaScript is here to stay, and rule the industry this decade. Do you agree? Tell me on my and handles - let's connect!

JavaScript将继续存在,并在这个十年统治整个行业。 你同意吗? 在我的和句柄上告诉我-让我们联系!

翻译自:

转载地址:http://wfuzd.baihongyu.com/

你可能感兴趣的文章
C++ vector 多次删除第一个元素
查看>>
JAVA遇见HTML——JSP篇:JSP内置对象(下)
查看>>
多态的动态绑定
查看>>
SpringMVC——拦截器
查看>>
深入了解整数在计算机内部的表示
查看>>
扩增子分析QIIME2-2数据导入Importing data
查看>>
OpenStack☞网关协议
查看>>
定位- 汽车导航
查看>>
转载 -- iOS数据持久化存储
查看>>
WebSocket 的使用
查看>>
P4702 取石子
查看>>
P4136 谁能赢呢?
查看>>
VS code 缩进设置
查看>>
vue项目中进行icon合并
查看>>
sql常用命令
查看>>
nginx的proxy_redirect
查看>>
解析xml并展示数据(mainActivity)
查看>>
进程、应用程序域
查看>>
非线性方程(组):高维方程解法
查看>>
圆锥体完全均衡下重力异常正演 [MATLAB]
查看>>