为什么Facebook不使用jQuery(或类似的)? [英] Why doesn't facebook use jQuery (or similar)?

查看:78
本文介绍了为什么Facebook不使用jQuery(或类似的)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Facebook基于JavaScript。为什么它不依赖于jQuery(或任何其他类似的库)?

Facebook is heavily JavaScript based. Why doesn't it rely on jQuery (or any other similar library)?

编辑:为什么要关闭这个问题?这不是主观的。 facebook不使用jQuery(或任何其他框架)是有原因的,我要求的。

Why close this question? this isn't subjective. facebook doesn't use jQuery (or any other framework) for a reason, that i am asking for.

推荐答案

简短回答:你将不得不问Facebook开发团队。

Short answer: You'll have to ask the Facebook development team.

最佳猜测:


  1. 拥有大型软件产品(以及成熟的代码库)的大公司倾向于坚持 - 即使有一个流行的框架已经迫使移动到那里。请记住,Facebook早在JQuery被认为是标准之前就已存在。

  1. Large companies with large software products (and mature code bases) tend to stick with what works - even when there is a popular framework already out there that is compelling to move to. Remember, Facebook was around long before JQuery was considered standard.

他们可能会在未来的许多年内支持他们现有的代码。对新语言或框架进行切换的成本比率的好处可能太低,无法保证重写或转换。举个例子:Sun没有将Solaris的大部分内容移植到Java。只有少量的Windows是用C#编写的。

They likely will be supporting their existing code for many more years to come. And the benefit to cost ratio of making a "switch" to a new language or framework may be too low to warrant a re-write or a transition. Case in point: Sun didn't port much of Solaris to Java. Only a marginal amount of Windows is written in C#.

在2011年当我第一次写这篇文章时:如果你真的看起来在Facebook的网站上,他们的DOM结构并不复杂。他们没有很多动画。它们不是一个非常重的AJAX网站。鉴于此,JQuery可能不会引人注目。 更新 - 2015年:FB比几年前更具活力。所以#3在这里的重量不和2011年那么重。

In the year 2011 when I first wrote this: if you actually look at Facebook's website, their DOM structure isn't that complex. They don't have very many animations. They aren't a very heavy AJAX site. Given that, JQuery may not be compelling for them. Update - In 2015: FB is much more dynamic than it was years ago. So #3 here doesn't hold the same weight as it did in 2011.

此外,当你有多个团队为一个软件产品做贡献时(或者网站),重要的是每个人都在相同的框架上标准化。如果每个团队都集成了不同的框架,那么代码就会通过所有这些不同库的链接而迅速膨胀。对于网站,这意味着更长的页面加载时间。

Also, when you have multiple teams contributing to a single software product (or web site), it's important that everyone standardize on the same framework. If every team integrated with a different framework, then the code becomes bloated quickly with linkage of all these different libraries. In the case of a website, this means longer page load times.

JQuery旨在支持最大的浏览器集。在某些情况下,这可能意味着针对最低公分母进行优化。 FB可能希望在可用时利用更新的浏览器功能。

JQuery is designed to support the largest set of browsers. In some cases, this might mean "optimizing for the lowest common denominator". FB may want to take advantage of newer browser features when available.

FB可能不希望太过锁定到JQuery。众所周知,JQuery对一些处于测试阶段的新浏览器存在一些漏洞。现在,如果Facebook拥有基于JQuery 1.6的百万行代码,那么近年来在IE 10,FF 5和Chrome 12上运行时可能会出现问题。为了实现这一目标,他们必须升级到JQuery 1.7,但这意味着需要在整个代码库中进行大量测试。

FB may not want to get too "locked in" to JQuery. JQuery was known to have a few bugs with some of the newer browsers that were in beta. Now if Facebook has a million lines of code based on JQuery 1.6, it might be buggy when run on IE 10, FF 5, and Chrome 12 near year. To make this work, they would have to upgrade to JQuery 1.7, but that means a huge amount of testing across their entire code base.

最后,他们可能会有一些内部比JQuery更好的东西。如果Facebook已经有一个服务器端框架,根据浏览器发出页面请求输出HTML + JS,我不会感到惊讶。

Finally, they may have something internal that works better than JQuery. I would not be surprised if Facebook already has a server-side framework that outputs HTML+JS based on the browser making the page request.

我认识到这些答案都不是很受欢迎。您团队中的哪位开发人员不想切换到最新最好的技术?但是,当您考虑业务案例和支持框架相对于业务规模的成本时,您必须谨慎行事。

I recognize that none of these answers are very popular. What developer on your team doesn't want to switch to the latest and greatest technology? But when you think about the business case and cost of supporting a framework relative to the size of your business, you have to tread carefully.

这篇关于为什么Facebook不使用jQuery(或类似的)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆