节点可以预测,分叉不可预测
Getting a website successfully delivered to a visitor depends on a series of actions. My server must spit something out. That something must be passed over some network. That something must then be consumed by another something: some client (often a browser) on some device. Finally, the visitor views that something in whatever context they happen to be in.
如何成功将网站交付给访问者取决于一系列操作。 我的服务器必须吐出一些东西 。 某些东西必须通过某个网络传递。 然后,某些东西必须被另一种东西消耗:某些设备上的某些客户端(通常是浏览器)。 最后,访问者认为无论碰巧碰到什么,这些东西都可以。
There are a lot of unpredictable layers here.
这里有很多不可预测的层。
I have no control over the network. It could be fast, it could be slow, it could be down entirely.
我无法控制网络。 它可能很快,可能很慢,可能完全崩溃了。
I have no control over the end device. It could be a phone, a laptop, an e-reader, a watch, a tv. It could be top-of-the line or it could be budget device with low specs. It could be a device released the other day, or a device released 5 years ago.
我无法控制终端设备。 它可能是电话,笔记本电脑,电子阅读器,手表,电视。 它可能是顶级产品,也可能是低规格的预算设备。 可能是前几天发布的设备,也可能是5年前发布的设备。
I have no control over the client running on that device. It could be the latest and greatest of modern browsers. It could be one of those browsers we developers love to hate. It could be a proxy browser. It could be an in-app browser.
我无法控制在该设备上运行的客户端。 它可能是现代浏览器中最新,最出色的浏览器。 它可能是我们开发人员喜欢讨厌的浏览器之一。 它可能是代理浏览器。 它可能是一个应用内浏览器。
I have no control over the visitor or their context. They could be sitting down. They could be taking a train somewhere. They could be multitasking while walking down the street. They could be driving (I know). They could be color-blind.
我无法控制访问者或其上下文。 他们可能坐下来。 他们可能在某处坐火车。 他们在街上散步时可能会做多任务。 他们可能在开车(我知道)。 它们可能是色盲的。
The only thing I control is my server environment. That’s it. Everything else is completely unpredictable.
我唯一控制的是我的服务器环境。 而已。 其他一切都是完全不可预测的。
So when I’m building something, and I want to make it robust—to make it resilient and give it the best chance it has to reach across this complicated mess full of unpredictability—I want to take advantage of the one thing I control by letting my server output something usable and as close to working as possible. That doesn’t mean it’s going to have the same fidelity as the ideal experience, but it does mean that provided there’s a network at least there’s an experience to be had.
因此,当我构建某件东西时,我想使其健壮(使其具有弹性,并为其提供最好的机会来克服充满不可预测性的复杂混乱),我想利用我控制的一件事让我的服务器输出可用的东西,并使其尽可能接近正常工作。 这并不意味着它将具有与理想体验相同的保真度,但是它的确意味着只要有网络就可以拥有至少一种体验。
From there I want to do whatever I can to provide offline support so that after that first visit I can reduce some of the risk the network introduces.
从那里我想尽我所能提供离线支持,这样,在第一次访问之后,我可以减少网络带来的一些风险。
I want to apply my JavaScript and CSS with care so that the site will still work and look as good as possible, no matter how capable their browser or device.
我想小心地应用我JavaScript和CSS,以便无论其浏览器或设备的功能如何,该网站都能正常运行并看起来尽可能的好。
I want to use semantic markup to give clients as much information as possible so that they can ensure the content is usable and accessible.
我想使用语义标记为客户提供尽可能多的信息,以便他们可以确保内容可用和可访问。
I want to build something that’s lightweight and fast so that my content gets to the visitor quickly and doesn’t cost them a fortune in the process.
我想构建一个轻量级且快速的内容,以便我的内容可以快速地吸引到访问者,并且在此过程中不会给他们带来很多财富。
I want to ensure that content is not hidden from the visitor so that they can get what they came for no matter their context.
我想确保访问者不会隐藏任何内容,以便无论上下文如何他们都可以得到他们想要的东西。
Of course there’s some nuance here in the details, and assumptions will naturally be made at some point. But I want to make as few of those assumptions as possible. Because every assumption I make introduces fragility. Every assumption introduces another way that my site can break.
当然,这里的细节有些细微差别,当然会在某些时候做出假设。 但是我想尽可能少地做出这些假设。 因为我所做的每个假设都会带来脆弱性。 每个假设都提出了另一种可能破坏我的网站的方式。
We used to call that progressive enhancement but I know that’s become a bit of loaded term with many. Discussions online, and more recently at EdgeConf have confirmed this.
我们曾经称其为渐进增强,但我知道这已经成为很多人的负担。 在线讨论以及最近在EdgeConf上的讨论都证实了这一点。
I’m not sure what we call it now. Maybe we do need another term to get people to move away from the “progressive enhancement = working without JS” baggage that distracts from the real goal.
我不知道我们现在怎么称呼它。 也许我们确实需要另一个术语来使人们摆脱“分散的进步=没有JS工作”的负担,这偏离了实际目标。
We’re not building something to work without JavaScript. That’s a short-sighted definition of the term. As both Paul Irish and Kyle Simpson pointed out during EdgeConf, it puts the focus on the features and the technology. It’s not about that.
没有JavaScript,我们就无法构建一些可以使用的东西。 这是该术语的短视定义。 正如Paul Irish和Kyle Simpson在EdgeConf大会上所指出的那样,它将重点放在功能和技术上。 不是那个
It’s about the users. It’s about finding ways to make our content available to them no matter how unpredictable the path that lies between us and them.
与用户有关。 这是关于无论我们与他们之间的路径如何变幻莫测,都可以找到使我们的内容可供他们使用的方法。
翻译自: https://timkadlec.com/2015/06/thriving-in-unpredictability/
节点可以预测,分叉不可预测