我如何停止担心并学会热爱JavaScript生态系统

Until a few months ago I could not even look at JavaScript without having a feeling of anxiety.

直到几个月前,我什至没有焦虑就不能看JavaScript。

I was 100% under the so-called JavaScript Fatigue and I could not get out of it.

在所谓JavaScript疲劳中,我100%处于困境,我无法摆脱它。

This lasted years.

这持续了几年。

Sinking

Today, I love JavaScript and its ecosystem.

今天,我喜欢JavaScript及其生态系统。

How did this happen?

这怎么发生的?

I’ve been using JavaScript in some form or another since the nineties, and I have some books on my shelf that looks very funny today, full of document.write statements.

从90年代开始,我就一直在以某种形式使用JavaScript,而且我的书架上有一些今天看起来很有趣的书,里面满是document.write语句。

It was probably 2012-2013, the huge changes that ES6 would bring us were all over the place.

大概是2012年至2013年,ES6带给我们的巨大变化无处不在。

At first, I could not pick up all the things that were going on. I could not accept so many changes all at once. JavaScript was changing but I was resistant. It took me so much to learn it properly, and it was changing under my feet.

起初,我无法收拾所有发生的事情。 我不能一次接受这么多更改。 JavaScript发生了变化,但我拒绝了。 我花了很多时间才能正确地学习它,并且它在我的脚下不断变化。

I found a really spot on comment made on a blog post when it argued that “learning modern JavaScript was tough if you haven’t been there since the beginning“:

我发现在博客发表的评论中确实有一个论点,当时它指出“ 如果您从一开始就没有去过那里,那么学习现代JavaScript将会很困难 ”:

I would argue being there since the beginning (yes, I’m that old) makes it even tougher  -  Tim Tate

我会争辩说从一开始就在那儿(是的,我年纪大了)使事情变得更加艰难-Tim Tate

I dived into JavaScript and Node.js seriously in 2012, and I had never experienced a language change so incredibly huge as ES6. The previous big change happened in 2009 with ES5. ES6 literally changed everything. It was such a huge revamp of JavaScript that every day you had so many things that could get into that spec but you didn’t really know if they made it, and you had to catch up as everyone on Twitter was talking about those things that maybe were the next big thing.

我在2012年认真研究了JavaScript和Node.js,但从未经历过像ES6那样巨大的语言更改。 先前的重大变化发生在2009年的ES5中。 ES6确实改变了一切。 这是对JavaScript的巨大改进,以至于每天都有很多东西可以纳入该规范,但您实际上并不知道它们是否成功,因此您必须赶上Twitter上的每个人都在谈论那些也许是下一件大事。

var was left in the dust.

var留在尘土中。

function does not exist anymore.

function不再存在。

Prototype-based inheritance, which took a long time to learn properly, is gone, hidden under the 🌈 carpet of classes.

基于原型的继承花了很长时间来正确学习,现在已经消失了,隐藏在课堂的地毯下。

This was just the surface. The whole JavaScript ecosystem has hugely changed in the last few years.

这只是表面。 过去几年中,整个JavaScript生态系统发生了巨大变化。

建立所有的东西 (Build all the things)

One big shift that was happening was building.

正在发生的一大变化是建筑

We went from a very simple thing, including our JavaScript with script tags, to having build steps that compile our language to some incomprehensible huge file. At first I resisted strenuously, I got up in my tower fully armed with cannons to fight the build army.

我们从一个非常简单的事情开始,包括使用带有脚本标签JavaScript,到建立将我们的语言编译为一些难以理解的大文件的步骤。 起初我奋力抵抗,我站满了大炮,与建军作战。

But when the Babel forces came along, I initially fought even harder but in the end I raised the white flag, and I joined the enemy.

但是当巴别塔部队进来时,我最初更加努力地战斗,但最终我举起了白旗,我加入了敌人

I realized Babel is not some fancy library that introduces future, edge features, and when those land in the browser we’ll forget Babel. No, Babel is here to stay, for the foreseeable future.

我意识到Babel并不是一个引入未来,边缘功能的奇特库,当这些功能进入浏览器时,我们会忘记Babel。 不,Babel在可预见的未来会留在这里。

When ES2017 will fully land in the browser, Babel will allow for ES2018, ES2019 and so on. There’s no escape. Embrace the future, Babel is your friend.

当ES2017完全进入浏览器时,Babel将允许使用ES2018,ES2019等。 没有逃脱。 拥抱未来,Babel是您的朋友。

使用最简单的选择 (Use the simplest alternatives)

The tooling is one of the hardest parts of JavaScript nowadays. Yes, you can learn all about Webpack but when you start out, ignore everything, and use ready-made solutions like create-react-app, the React Boilerplate will hide the tiny details for you and let you focus on the code.

该工具是当今JavaScript最困难的部分之一。 是的,您可以了解有关Webpack的全部知识,但是当您起步时,可以忽略所有内容,并使用现成的解决方案(如create-react-app) ,React Boilerplate将为您隐藏一些微小的细节,让您专注于代码。

Don’t start by setting up an environment, learn by using Glitch. There’s no simpler way to start diving into modern JavaScript.

不要从建立环境开始,而要使用Glitch进行学习。 没有简单的方法可以开始涉足现代JavaScript。

没有更多的大发行 (No more huge releases)

ES6 was so big that the ECMAScript committee decided to do smaller releases next time. This is why ES6 is also called ES2015, and was the first release with the year- we’ll have a yearly release from now on. It’s easier to catch up, will have less changes as the time to add them is limited, and it’s predictable (keep in mind though, there will be change).

ES6太大了,以致ECMAScript委员会决定下一次发布较小的版本。 这就是为什么ES6也称为ES2015的原因,并且是该年度的第一个版本-从现在开始我们将每年发布一次。 赶上它更容易,因为添加它们的时间有限,所以更改较少,而且可以预见(尽管请记住,会有更改)。

忽略嗡嗡声 (Ignore the buzz)

If you’re like me, you might follow a lot of people on Twitter that are always on the edge. Maybe some thought leaders that dictate what’s the next big thing. They say to use X, everyone else uses X.

如果您像我一样,您可能会在Twitter上关注很多始终处于边缘的人。 也许某些思想领袖决定了下一件大事。 他们说使用X,其他所有人都使用X。

Maybe they like to show their snippets using the latest APIs which are not even close to being standard, but can be used with a flag in the browser.

也许他们喜欢使用最新的API显示片段,这些API甚至不接近于标准,但可以与浏览器中的标志一起使用。

They might have a good reason. You do not. Don’t fall in the trap of the shiny new toys, focus on your work.

他们可能有充分的理由。 你不。 不要落入闪亮的新玩具的陷阱,专注于工作。

每周没有新的框架 (There is not a new framework every week)

There is a joke floating around that says “whatever JavaScript framework flavor of the month” or “there’s a new library every week”. That’s true, there is a gazillion people working on JavaScript and this is great, it brings innovation and evolution, the kind JavaScript experienced in the last few years, which were huge for the language ecosystem.

有个笑话说“每月JavaScript框架是什么”或“每周都有新的库”。 没错,有不计其数的人在研究JavaScript,这很棒,它带来了创新和发展,这是最近几年经历的那种JavaScript,这对于语言生态系统而言是巨大的。

But the thing to note is that the big things do not change much frequently.

但是要注意的是,大的事情不会经常改变。

React is 6 years old.

React是6岁。

Vue is 5 years old.

Vue是5岁。

5 years is a very long time in tech. Those are stable technologies. Learn it now, they are here to stay for a long time, too - they are not going away.

5年对于技术而言是很长的时间。 这些是稳定的技术。 现在学习它,他们也将在这里停留很长时间-他们不会消失。

You have plenty of time to become an expert in any of those frameworks, they are not going to go away anytime soon.

您有足够的时间成为这些框架中的任何一个的专家,它们不会很快消失。

接受事物来去去 (Accept that things come and go)

That said, anything has a lifecycle.

也就是说,任何事物都有生命周期。

A few years ago jQuery was used everywhere, now rarely do new projects start with it.

几年前,jQuery随处可见,现在很少有新项目开始使用它。

In 2013 Backbone.js was huge. Now it has disappeared from the map. CoffeeScript, removed from the face of earth.

2013年,Backbone.js规模巨大。 现在它已经从地图上消失了。 CoffeeScript,从地球表面移除。

Ember.js, Angular.js, and Meteor rocked and stayed at the top of their popularity for a few years, now the most talked about ones seem to be React, Vue, and Angular (which is different from Angular.js).

Ember.js,Angular.js和Meteor摇摆不定,并保持了几年的流行状态,现在最受关注的似乎是React,Vue和Angular(与Angular.js不同)。

Each cycle for those major frameworks usually lasts quite a few years. I still have lots of Ember.js applications running just fine, there is no need to update them if they do their job, and I don’t plan to touch them.

这些主要框架的每个周期通常持续数年。 我仍然有许多运行良好的Ember.js应用程序,如果他们能完成工作就不需要更新它们,而且我也不打算碰它们。

Tech evolves and matures, then it gets used rather than talked about.

科技不断发展和成熟,然后被使用而不是谈论。

您对使用jQuery并不傻 (You are not stupid for using jQuery)

Some people have a thick skin. But if you read around enough, you will find those that despise the technology that everyone once used and inform you that you are wrong. 😆

有些人的皮肤很厚。 但是,如果您阅读的内容足够多,就会发现那些鄙视每个人曾经使用过的技术的信息,并告诉您您错了。 😆

Having used PHP for a long time, I got used to this, it’s normal to have people criticizing something popular. Even Go, which is amazing for its simplicity, is sometimes criticized for that. You will always find someone that throws shit at something.

使用PHP已有很长时间了,我已经习惯了这一点,人们批评流行的东西是正常的。 即使是Go,它的简单性也令人赞叹,但有时也会因此受到批评。 您总会发现有人对某事大骂。

As an example, I have to cite this tweet by Pieter Levels, who built a huge independent business with a single PHP file.

例如,我必须引用Pieter Levels的推文,他用一个PHP文件建立了庞大的独立业务。

Pieter

But as a beginner you might find out someone that says you’ve chosen an old tech, that no one uses it any more, that you should use React instead. Ignore them, move them out of your mind.

但是,作为一个初学者,您可能会发现有人说您选择了一种旧技术,没有人再使用它,而应该使用React。 忽略它们,将它们移出您的脑海。

Remember:

记得:

If it works for you, it’s the right stack.

如果它适合您,那么它是正确的堆栈。

Most of the times tech is built from giant companies with needs completely, radically different than yours, or the ones of your small team. Go with what you know and make a difference even without using leading edge technology.

多数情况下,技术是由与您或您的小型团队完全,根本不同的巨型公司构建的。 随心所欲,即使不使用领先技术也能有所作为。

Now, you probably don’t need jQuery. But not in the place of a framework - plain JavaScript is super fine.

现在,您可能不需要jQuery。 但不能代替框架-普通JavaScript非常好。

The other part of the spectrum is over-engineering. Don’t use tech just to feel smarter. Know it better. And learn when to use a framework or library that helps you.

频谱的另一部分是过度工程。 不要仅仅为了感到聪明而使用技术。 更好地了解它。 并了解何时使用对您有帮助的框架或库。

您没有义务了解所有内容。 找到你的平衡。 (You don’t have any obligation to know everything. Find your balance.)

While it might sound like it from reading your Twitter feed, no one knows all the things. There’s no way someone can learn all the stuff that’s going on in frontend development. This is a lifetime school. There’s absolutely no way to graduate.

阅读您的Twitter feed听起来可能听起来很像,但没人知道所有事情 。 有人无法学习前端开发中发生的所有事情。 这是一所终身学校。 绝对没有办法毕业。

通过用户友好的文档选择技术 (Pick tech with user-friendly documentation)

It’s not by chance that React and Vue have amazing documentation. It’s a key part of their success.

React和Vue拥有出色的文档并不是偶然的。 这是他们成功的关键部分。

JavaScript将再次发展 (JavaScript will evolve again)

Last year the ECMAScript language introduced await/async and now that feature of the language is used a lot. Promise-based code simply looks bad, you feel the urge to rewrite everything.

去年,ECMAScript语言引入了await / async,现在该语言的功能得到了广泛使用。 基于承诺的代码看起来简直糟透了,您有重写一切的冲动。

Don’t do it, and instead use new features for the new code you write. The same will happen this year, with ES2018. Everyone will talk about them for a while, then we’ll get back to work and we’ll start talking about the ES2019 features.

不要这样做,而是对您编写的新代码使用新功能。 ES2018今年也会发生同样的情况。 每个人都会谈论它们一段时间,然后我们将恢复工作,并开始谈论ES2019功能。

Embrace the change. It’s much better than betting on tech that stalls and then fades into being irrelevant in a few years: JavaScript is here to stay!

拥抱变化。 这比押注技术停滞然后消失在几年之内变得无关紧要要好得多: JavaScript会留下来

学习基本原理,并选择自己的旅程 (Learn the basic fundamentals, and pick your own journey)

Developing on the Web Platform requires a commitment to learn something new often, even just to find out what’s possible.

在Web平台上进行开发需要承诺经常学习一些新知识,甚至只是找出可能的东西。

Sometimes learning in 20% of the time the 80% of the things you will need is enough, without diving too much into the edge cases.

有时候,在20%的时间里学习所需的80%的东西就足够了,而不必花太多时间在边缘情况下。

旅程刚刚开始 (The journey has just begun)

JavaScript is still very young compared to other languages, it’s hugely popular and it was able to dramatically change in the last few years. It attracts lots of talented new developers every day, and it’s fascinating thinking about the JavaScript we’ll write in 10 or 20 years from now.

与其他语言相比,JavaScript仍然很年轻,它非常流行,并且在过去几年中发生了巨大变化。 它每天都吸引着许多有才华的新开发人员,并且令人着迷的是我们将在10或20年后编写JavaScript。

Road

翻译自: https://flaviocopes.com/solve-javascript-fatigue/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值