当前位置: 首页 > 编程日记 > 正文

捍卫者usb管理控制系统_捍卫超模块化JavaScript

捍卫者usb管理控制系统

by Mike Groseclose

通过Mike Groseclose

捍卫超模块化JavaScript (In Defense of Hyper Modular JavaScript)

Last week npmgate was a big topic for the JavaScript community. For those of you who haven’t been following what happened, here’s the TL;DR:

上周,npmgate对JavaScript社区来说是一个大话题。 对于那些没有关注发生的事情的人,这里是TL; DR:

A company, named Kik, asked Azer Koçulu to give them the kik project name on npm. Azer said no (because he was already using it). Kik asked again, this time threatening to get lawyers involved for Trademark infringement. Azer forcefully said no and Kik escalated to npm. npm sided with Kik and moved ownership of the module away from Azer. In response Azer wrote I’ve Just Liberated My Modules and removed all of his packages from npm. One of the packages he removed was left-pad.

一家名为Kik的公司要求AzerKoçulu在npm上给他们命名kik项目。 Azer说不(因为他已经在使用它)。 Kik再次询问,这次威胁要让律师参与商标侵权。 Azer坚决拒绝,Kik升级为npm。 npm支持Kik,并将该模块的所有权移交给Azer。 作为回应,Azer写了《 我刚刚解放了我的模块》,并从npm中删除了他的所有软件包。 他卸下的一个包裹是左垫

The removal of left-pad from npm essentially broke the install process for any project using it as a dependency. The impact of this was large as it was being used by a large number of very popular projects (Babel, Atom, and React to name a few).

从npm中删除左键盘本质上破坏了任何使用它作为依赖项的项目的安装过程。 它的影响是巨大的,因为它被许多非常受欢迎的项目(Babel,Atom和React等)使用。

The Internet caught on fire ?.

互联网着火了。

This all caused a number of questions to be raised, most of which can be categorized by the following:

所有这些都引发了许多问题,其中大多数可以按以下类别进行分类:

  1. Was this a trademark infringement? A legal issue.

    这是商标侵权吗? 一个法律问题。
  2. Should npm have sided with Kik? A business issue.

    npm应该支持Kik吗? 业务问题。
  3. Should you be able to un-publish a module that is a dependency of another module? A technical concern.

    您是否应该能够取消发布依赖于另一个模块的模块? 技术上的关注。
  4. Should npm modules be mutable? A technical concern.

    npm模块应该可变吗? 技术上的关注。
  5. Should the community use modules like left-pad as dependencies to begin with? A much larger discussion.

    社区是否应该使用像左键盘这样的模块作为依赖项开始? 更大的讨论。

npm, and their legal team, will be the ones that ultimately need to figure out the business and legal issues (#1 & #2 above). It will be up to them to determine if this was truly was a trademark infringement and what the policy on requests like this will be going forward.

npm及其法律团队将是最终需要弄清业务和法律问题的人员(上述第一名和第二名)。 由他们来确定这是否确实是商标侵权,以及将对此类请求采取什么样的政策。

For #3 above (the ability to un-publish a module that is a dependency of another published module) npm has made the following statement:

对于上面的#3(取消发布作为另一个发布模块的依赖项的模块的能力),npm做出了以下声明:

npm needs safeguards to keep anyone from causing so much disruption. If these had been in place yesterday, this post-mortem wouldn’t be necessary.
npm需要采取保护措施,以防止任何人造成如此多的破坏。 如果这些在昨天已经到位,则无需进行验尸。

- @izs from kik, left-pad, and npm

-来自ikk ,左键盘和npm的@izs

Although npm-shrinkwrap can help with some of the mutability issues (#4), the only real mitigation I have seen is to bundle your dependancies with your published package. Rich Harris explains this in his article How to not break the internet with this one weird trick.

尽管npm-shrinkwrap可以解决某些可变性问题(#4),但我看到的唯一真正的缓解方法是将您的依赖关系与发布的软件包捆绑在一起。 里奇·哈里斯(Rich Harris)在他的文章“ 如何用这种奇怪的技巧不破坏互联网”中对此进行了解释。

So that leads us to #6, the reason this article exists:

因此,我们进入了第六条,这是本文存在的原因:

社区是否应该使用像左键盘这样的模块作为依赖项开始? (Should the community use modules like left-pad as dependencies to begin with?)

In order to understand why this is even a debate, we should first understand left-pad. Given a string (str), length (len), and character (ch), left-pad will pad the left side of str with ch until the string length equals len.

为了理解为什么这甚至是一个辩论,我们应该首先了解left-pad 。 给定一个字符串(str),长度(len)和字符(ch), left-pad将用ch填充str的左侧,直到字符串长度等于len为止。

Here is the entirety of the code powering left-pad:

这是为左键盘供电的全部代码:

The idea that 17 lines of code (221 characters) was behind the implosion of the internet created a lot of complaints about the use of hyper-modular packages within the JavaScript community.

互联网崩溃的背后是17行代码(221个字符)的想法引起了很多人对JavaScript社区内使用超模块化包的抱怨。

So with that, (finally) I begin.

因此,(最后)我开始了。

npmgate与左键盘模块的大小无关 (npmgate had nothing to do with the size of the left-pad module)

The size of left-pad is a red herring. How many lines of code it contains is completely irrelevant to the discussion of how its removal from the npm ecosystem broke other packages. It could have been the removal of any package from the ecosystem which caused this.

左垫的大小是红色鲱鱼。 它包含多少行代码与从npm生态系统中删除它如何破坏其他软件包的讨论完全无关。 可能是从生态系统中删除了任何软件包造成的。

Azer removed 272 modules during his exodus from npm. It’s definitely safe to say that left-pad was written by a developer who has established himself in the community.

Azer在npm出走期间删除了272个模块。 可以肯定地说左护板 由在社区中立足的开发人员撰写。

Those who argue that having a dependency like left-pad adds risk to their project are essentially arguing against having any external npm dependancies in their project.

那些认为像左撇子这样的依赖关系会给他们的项目增加风险的人实质上是在反对在项目中拥有任何外部npm依赖关系。

是的,我们都可以从头开始编写类似左键盘的模块 (Yes, we can all write modules like left-pad from scratch)

But why would we want to?

但是我们为什么要呢?

The whole reason utility libraries like jQuery and lodash were created is to make the developer experience better.

创建实用程序库(如jQuery和lodash)的全部原因是为了使开发人员体验更好。

Sure the code behind left-pad is not very complex and it could probably be rewritten by any of us in a few minutes. Some may even enjoy the detour. That said, context switching from writing code solving the problem at hand to writing a method that manipulates strings seems like a poor use of time and energy. Remember, just because we can do something doesn’t mean we should.

确保左键盘后面的代码不是很复杂,并且我们中的任何人都可能在几分钟后将其重写。 有些人甚至可能会绕道而行。 也就是说,上下文从编写解决手头问题的代码到编写操纵字符串的方法的上下文切换似乎浪费了时间和精力。 请记住,仅仅因为我们可以做某事并不意味着我们应该这样做。

Everyday we should be enabling ourselves to focus on problems bigger and better than the day before.

我们每天都应该使自己能够专注于比前一天更大和更好的问题。

社区 (Community)

There is reason npm is outperforming all other package managers when it comes to growth. The barrier to entry to participate by publishing a package to npm is extremely small.

在增长方面,npm有理由胜过所有其他软件包管理器。 通过将软件包发布到npm来参与的障碍非常小。

Enabling more developers to participate in the process, regardless of the contribution size, can only cause the community to grow stronger.

无论贡献大小如何,使更多的开发人员都可以参与该过程,只能使社区变得更强大。

自由市场JavaScript (Free-market JavaScript)

Standards will probably never be able to keep up with the momentum and speed at which the JavaScript community is moving. This is OK. In this new world of free-market JavaScript, may the best module win. Good modules should grow as they get more downloads and community involvement, whereas modules not used or supported will slowly disappear into the virtual abyss. In fact, there are cases, such as bluebird, where the community library will out-perform the standard library (see Why are native ES6 promises slower and more memory-intensive than bluebird?)

标准可能永远无法跟上JavaScript社区发展的势头和速度。 还行吧。 在这个自由市场JavaScript的新世界中,最好的模块可能会赢。 好的模块会随着它们的更多下载和社区参与而增长,而未使用或未支持的模块将逐渐消失在虚拟的深渊中。 实际上,在某些情况下(例如bluebird) ,社区库的性能将超过标准库(请参阅为什么本机ES6承诺比bluebird速度更慢,内存占用更多​​? )

So with all these modules how do you know which modules are safe to use? The truth is, as with any open source software, you never know for sure. But here’s the litmus test I use when including anything from npm in my project:

那么,对于所有这些模块,您如何知道哪些模块可以安全使用? 事实是,就像任何开源软件一样,您永远无法确定。 但是,这是我在项目中包含npm中的任何内容时使用的石蕊测试:

  1. Is the package well documented?

    包装是否有据可查?
  2. Does it have tests?

    有测试吗?
  3. Are people using it?

    人们在使用它吗?
  4. Does the community have opinions about it (usually this only applies to larger modules)?

    社区对此有意见吗(通常仅适用于较大的模块)?

这与大小无关,与功能有关 (It’s not about size, it’s about functionality)

The beauty of our ecosystem is that modular development encapsulates responsibility and forces a separation of concerns. The size of the module should be irrelevant to the discussion, whereas the functionality is key.

我们生态系统的优点在于,模块化开发封装了责任,并迫使关注点分离。 模块的大小应该与讨论无关,而功能是关键。

The strength of any good hyper-modular package is that it will have a well defined interface, clearly documented, and well tested. Don’t we want all of our code to be composed from modules like that?

任何优质的超模块化封装的优势在于,它将具有定义明确的接口,明确记录并经过良好测试。 我们不希望我们的所有代码都由这样的模块组成吗?

模块是关于可组合性的 (Modules are about composability)

Think of node modules as lego blocks. You don’t necessarily care about the details of how it’s made. All you need to know is how to use the lego blocks to build your lego castle. — Sindre Sorhus from AMA #10

将节点模块视为乐高积木。 您不必关心其制作细节。 您只需要知道如何使用乐高积木来建造乐高城堡。 —来自AMA#10的 Sindre Sorhus

In the end, this is all about composition. So, let’s continue building modules, let’s use those modules to build other modules, and those modules to build systems. Let’s compose those systems together to start building things that have never been done before.

最后,这一切都与构图有关。 因此,让我们继续构建模块,使用这些模块构建其他模块,并使用这些模块构建系统。 让我们将这些系统组合在一起,开始构建以前从未做过的事情。

Final note: I should be clear that I’m not saying that everything should be a tiny module. If anything, I’d like to see more large opinionated libraries in the community (another brain-dump for another day). In the meantime though, we should remember that some of the things being complained about right now are the same things that have made the JavaScript community so great.

最后说明:我应该清楚,我并不是说所有内容都应该是一个很小的模块。 如果有的话,我想在社区中看到更多大型的自以为是的图书馆(另一天动脑筋)。 但是,与此同时,我们应该记住,现在抱怨的某些事情与使JavaScript社区变得如此出色的事情相同。

Thanks.

谢谢。

翻译自: https://www.freecodecamp.org/news/in-defense-of-hyper-modular-javascript-33934c79e113/

捍卫者usb管理控制系统

相关文章:

Android开发——布局性能优化的一些技巧(一)

0. 前言上一篇我们分析了为什么LinearLayout会比RelativeLayout性能更高,意义在于分析了这两种布局的实现源码,算是对一个小结论的证明过程,但是对布局性能的优化效果,对这两种布局的选择远不如减少布局层级、避免过分绘制、按需加…

1-RAC基础

1 安装 pod ‘ReactiveObjC’ RAC 其实大大减少了代码量 2 基本使用 // 0 RAC 中最为常见的类 信号类/*RACSignal:信号类1.通过RACSignal 创建1个信号(默认:冷信号)2.通过订阅者,订阅信号信号(变成:热信号…

static用法总结

C的static有两种用法:面向过程程序设计中的static和面向对象程序设计中的static。前者应用于普通变量和函数,不涉及类;后者主要说明static在类中的作用。 一、面向过程设计中的static1、静态全局变量2、静态局部变量3、静态函数二、面向对象的…

小程序 缩放_缩放流星应用程序的初体验

小程序 缩放by Elie Steinbock埃莉斯坦博克(Elie Steinbock) 缩放流星应用程序的初体验 (First Experiences Scaling a Meteor App) I recently went through the challenge and ordeal of having to scale my Meteor app. It’s a project that had already been running in …

SQL Server Lock Escalation - 锁升级

Articles Locking in Microsoft SQL Server (Part 12 – Lock Escalation) http://dba.stackexchange.com/questions/12864/what-is-lock-escalation 2008 R2 Lock Escalation (Database Engine)---Forward from Locking in Microsoft SQL Server (Part 12 – Lock Escalation)…

Jzzhu and Chocolate

CF#257 div2 C:http://codeforces.com/contest/450/problem/C 题意:n*m的方格,每次可以横着或者纵向的切一刀,问切k之后,最小的最大是多少。 题解:比赛的时候没有想到怎么处理,看了别人的题解,才…

2-RACommand

RACommand RACCommand 就是命令 // RACCommand 就是命令// 0 创建一个CMD 穿进去一个用于构建RACSignal的Block参数来初始化RACommandRACCommand *cmd [[RACCommand alloc]initWithSignalBlock:^RACSignal * _Nonnull(id _Nullable input) {// 此处是cmd 执行的输入源NSLog(…

玻璃上的编码喜悦(+ 10史诗般的Epigrams)

by Den McHenry丹麦克亨利(Den McHenry) 玻璃上的编码喜悦( 10史诗般的Epigrams) (Perlis on Coding Joy ( 10 Epic Epigrams)) Alan J. Perlis was the first recipient of the Turing Award. He’s possibly most remembered today for his Epigrams on Programming, which …

【Android】Activity生命周期(亲测)

测试手机:Nexus 5 系统:4.4 一、测试 测试代码: 1 package com.example.androidalarm;2 3 import android.app.Activity;4 import android.content.Context;5 import android.content.res.Configuration;6 import android.os.Bundle;7 impo…

angularjs 学习笔记 简单基础

angularjs是谷歌公司的一个项目,弥补了hml在构建方面的不足,通过指令(directive)来扩展html标签,可以使开发者使用html来声明动态内容。 angularjs主要用来开发单页应用(SPA)为主的项目。 angul…

3-RACSignal 常用方法

RACSingal的常用方法 一 基本使用 1map // 0 创建信号提供者// RACSubject,既能发送信号,又能订阅信号// 多用于代理,相当于OC里的delegate或者回调blockRACSubject *subject [RACSubject subject];// 1 绑定信号RACSignal *bindSignal …

javascript迭代_探索JavaScript迭代

javascript迭代by Festus K. Yangani由Festus K.Yangani 探索JavaScript迭代 (Exploring JavaScript Iteration) Loops allow programs to perform repetitive tasks, such as iterating through an array, while adhering to the DRY principle (Don’t Repeat Yourself). Th…

4 RACMulticastConnection 连接类

# RACMulticastConnection信号被多次订阅如果一个信号多次被订阅&#xff0c;那么代码块代码会多次被执行。objective-c// 创建信号RACSignal *sg1 [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber> _Nonnull subscriber) {NSLog("网络请求…

ie6下常见的bug 调整页面兼容性

ie6下常见的bug 我们布局页面&#xff0c;首先符合标准&#xff0c;如何写一个页面的标准性&#xff1f; 但是ie6等浏览器本身就比较特殊&#xff0c;bug比较多&#xff0c;兵法云&#xff0c;知己知彼百战百胜。我们需要了解ie6的一些常见bug&#xff0c;这样&#xff0c;更好…

Cacti安装详细步骤

Cacti安装详细步骤 前提LNMP或LAMP架构已搭建完成 一、cacti概述 1. cacti是用php语言实现的一个软件&#xff0c;它的主要功能是用snmp服务获取数据&#xff0c;然后用rrdtool储存和更新数据&#xff0c;当用户需要查看数据的时候用rrdtool生成图表呈现给用户。因此&#xff0…

为什么使用单页应用_为什么我讨厌您的单页应用

为什么使用单页应用by Stefan Tilkov斯蒂芬蒂尔科夫(Stefan Tilkov) 为什么我讨厌您的单页应用 (Why I hate your Single Page App) Okay, now that I have your attention, let me say that I don’t really hate your single page app. I just find it highly annoying, unl…

marquee实现文字移动效果;js+div实现文字无缝移动效果

1.marquee实现文字移动&#xff1a; <marquee width"220px;" scrollamount"5" onmouseover"this.stop()" onmouseout"this.start()" ><p style"letter-spacing:2px;width: 1px;">欢迎您登录拜博医疗口腔集团内部…

URAL 1203 Scientific Conference(贪心 || DP)

Scientific Conference 之前一直在刷计算几何&#xff0c;邀请赛连计算几何的毛都买见着&#xff0c;暑假这一段时间就做多校&#xff0c;补多校的题目&#xff0c;刷一下一直薄弱的DP。多校如果有计算几何一定要干掉-。- 题意&#xff1a;给你N个报告会的开始时间跟结束时间&a…

5- RAC 集合 RACTuple RACSequence

RAC 集合 RACTuple RACSequence // 0 RACTuple 就是一个数组/*RACTuple 就是一个数组*/RACTuple *tp1 [RACTuple tupleWithObjects:"5",5,1, nil];RACTuple *tp2 [RACTuple tupleWithObjectsFromArray:["11","22","33"]];NSLog(&quo…

测试开发人员与开发人员_如何升级为开发人员

测试开发人员与开发人员by Will Hughes威尔休斯(Will Hughes) 如何升级为开发人员 (How to Level up as a Developer) Being a productive developer is something you can learn through experience, books, or trial and error. But, one of the best ways to become a prod…

ORA-00959: tablespace 'PSAPTEMP' does not exist

错误 : ORA-00959: tablespace PSAPTEMP does not exist 解决办法: CREATE TEMPORARY TABLESPACE PSAPTEMP TEMPFILE E:/Oracle/ORC/sapdata3/temp_1/temp.data1 SIZE 500M REUSE AUTOEXTEND ON NEXT 100M MAXSIZE unlimited EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;ALTER …

RAC rac_liftSelector

RAC rac_liftSelector 主要是用于线程的同步 - (void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view, typically from a nib.// rac_liftSelector// 类似于dispatch_group 中的组// 多线程中的组 等所有的请求都完毕之后 去更新UIRAC…

随笔记一些莆田话

莆田话是闽南话和福州话混合的产物&#xff0c;当然也是古汉语保留至今的珍宝。很多莆田话的词语是有源可溯的。这里记录一些平常想到的又可能不为人知的词语。 莆田话——普通话解释 物件——东西 万代——很多 先生——老师&#xff08;先生白读时是老师的意思&#xff09;&a…

JavaScript库和API

by Adam Recvlohe通过亚当雷夫洛厄(Adam Recvlohe) API就像一盒巧克力 (APIs are like a box of chocolates) If you have written JavaScript for the DOM before, then you probably know how unwieldy it can get. I mean getElementById is seven syllables and 14 charac…

Hadoop 全分布模式 平台搭建

现将博客搬家至CSDN&#xff0c;博主改去CSDN玩玩~ 传送门&#xff1a;http://blog.csdn.net/sinat_28177969/article/details/54138163 Ps&#xff1a;主要答疑区在本帖最下方&#xff0c;疑点会标注出来。个人在配置过程中遇到的困难都会此列举。 实验介绍&#xff1a; 本次实…

iOS 使用fastlane自动化打包步骤

加粗样式### iOS 使用fastlane 自动打包步骤 &#xff01;参考 1 查看ruby版本信息 本机是否安装ruby ruby -v 2 安装xcode命令行工具 点击同意即可 xcode-select --install 3 安装fastlane 键入如下命令 sudo gem install fastlane -NV4 使用 1 打开终端 cd 进入到要打包的…

今天开始搞CentOS 7

今天开始搞CentOS 7,安装过程很顺利&#xff0c;界面相当友好。转载于:https://www.cnblogs.com/lixd/p/3868649.html

java ruby_Java,Ruby和Go,我的天哪!

java rubyFree Code Camp has focused 100% on full stack JavaScript since we started 17 months ago. We’ve taught JavaScript on the front end, JavaScript on the back end (thanks to the powerful Node.js framework) — and even JavaScript as a database querying…

http和https的区别 与 SSL/TLS协议运行机制的概述

http和https的区别 与 SSL/TLS协议运行机制的概述 参考1 1 http 是不使用的SSL/TSL的通信通道 窃听风险&#xff1a;第三方获取通信内容篡改风险&#xff1a;修改通信内容冒充风险&#xff1a;冒充他人身份参与通信 2 SSL/TSL 协议应运而生 客户端先向服务器端索要公钥&am…

Babel 相关资料

Babel online editorBabel Plugin Handbookbabeljs usage options转载于:https://www.cnblogs.com/skating/p/6125227.html