Why doesn't facebook use jQuery (or similar)?

12,389

Solution 1

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

Best guesses:

  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.

  2. 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#.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

  7. 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.

Solution 2

Because they choose to do their own thing?

Solution 3

Facebook doesn't rely on libraries for the exact reason you stated, it is heavily javascript based. Because of this, they want full control and customization of the code that they write. This is so they can write solutions that are specific to their applications, which also allow for efficiency. Efficiency is a huge thing for all sites (and most definitely Facebook) and this way they can easily edit their code easily to perform to their likings.

Solution 4

If you want my opinion:

I think the only reason is because Facebook was out in 2003/2004, jQuery in 2006. At that point was too late to reconvert all js to jQuery

Solution 5

Because they build what they need on their own, jQuery is also Javascript.

Share:
12,389

Related videos on Youtube

dynamic
Author by

dynamic

__ _ ____/ /_ ______ ____ _____ ___ (_)____ / __ / / / / __ \/ __ `/ __ `__ \/ / ___/ / /_/ / /_/ / / / / /_/ / / / / / / / /__ \__,_/\__, /_/ /_/\__,_/_/ /_/ /_/_/\___/ /____/ avatar from http://www.pinterest.com/pin/504332858244739013/

Updated on September 16, 2020

Comments

  • dynamic
    dynamic almost 4 years

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

    Edit: 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.

    • Jared Farrish
      Jared Farrish over 13 years
      This is pretty subjective by nature. Why not use MooTools? YUI? Maybe because they have to, due to earlier decisions, or current requirements, or a board director supports a new custom setup. This is a non-issue.
    • Chance
      Chance over 13 years
      because John Resig works for Mozilla, not Facebook.
    • dynamic
      dynamic over 13 years
      why close this question? this isn't subjective. facebook doesnt' use jquery (or any other framework) for a reason
    • Sikshya Maharjan
      Sikshya Maharjan over 13 years
      @yes123: without input from Facebook devs this question cannot be objectively answered, we can only offer speculation.
    • haha
      haha over 13 years
      Hope Mark Zuckerberg will answer this question. Let me invite (-_-')
    • dynamic
      dynamic over 13 years
      if no fb devs come here then the best speculation will get the most near to truth
    • haha
      haha over 13 years
      Ok Mark Zuckerberg said he used FBJS :p
    • chenglou
      chenglou almost 11 years
      I stumbled upon this question a few months ago, and coincidentally found the answer when discussing with Facebook people concerning the framework they use: groups.google.com/d/msg/reactjs/2DVIcjDRVbo/yCteaO-7LQkJ Read the whole thing for a context. Basically, they use a framework whose functionalities are so neat that, in various aspects, they don't need raw jQuery manipulations anymore. This pretty much holds true after experimenting with their framework personally.
  • dynamic
    dynamic over 13 years
    how many big companies have you been employed for? xD
  • jdonley
    jdonley over 13 years
    as for me personally, 1. But I do know lots of people :P
  • dynamic
    dynamic over 13 years
    this could be a good reason. But don't tell me facebook performance are good xD
  • jdonley
    jdonley over 13 years
    no but seriously, in my experience, it usually does boil down to something like this. Or branding. They don't want people to think they are somehow cheap by using 3rd party stuff. Or somehow endorsing one over the other. IOW politics.
  • Jared Farrish
    Jared Farrish over 13 years
    @yes123 - You have no idea what kind of conditions FB engineers face.
  • Peter
    Peter over 13 years
    This fails to mention caching, which is a hugely significant factor here. There is no way you should be loading jQuery from a remote server on every request!
  • dynamic
    dynamic over 13 years
    @jared: no i never worked for fb
  • Matthew Flaschen
    Matthew Flaschen over 13 years
    They do use at least internal libraries. They have released one, their Animation library, to the public.
  • Matthew Flaschen
    Matthew Flaschen over 13 years
    @Peter, Facebook could host jQuery on their own servers. And even if they used something like Google's AJAX CDN, why would it be loaded on every request? It would sometimes even be loaded before someone visited Facebook.
  • Jared Farrish
    Jared Farrish over 13 years
    @yes123 - Comparing your singular experience of FB performance to the needs/requirements of a website which is easily top 3 in requests at any moment is fruitless. I'm not saying they make decisions that are always useful or informed, but give them credit: The site works more often than not.
  • dynamic
    dynamic over 13 years
    @matthew: that library is completly down. the internal link to documentations points to bing search. fail
  • Peter
    Peter over 13 years
    @Matthew: that's exactly what I meant. I was wondering why @Mike seemed to think jQuery would be loaded from the servers on every request. Of course it would be cached.
  • Mike Lewis
    Mike Lewis over 13 years
    @Peter, you should attack the disease not the symptom. I agree caching can help a ton, however (implementing their own library + caching) is better than (using jQuery and caching)
  • dynamic
    dynamic over 13 years
    @jared: actually it suffers of a lot of downtime/slowness. If i had 2bil/year I could buy the same server farms that powers fb
  • Jared Farrish
    Jared Farrish over 13 years
    @yes123 - Then you should work for Facebook, solve all their problems. Believe me, brilliant people work for FB (I used to live near their headquarters, and Google HQ). jQuery will not solve the problems that FB faces. If you honestly believe so, then you are very naive.
  • stealthyninja
    stealthyninja over 13 years
    @yes123: That would be awesome, but looking specifically at SO's FAQ, this question doesn't really fall within what a question is.
  • dynamic
    dynamic over 13 years
    who said jquery solves fb issues?
  • Matthew Flaschen
    Matthew Flaschen over 13 years
    @yes, you can get it from here. The BSD license mentioned in my link still applies.
  • Jared Farrish
    Jared Farrish over 13 years
    @yes123 - If you were part of the FB solution, I believe your insight/questions would be considerably different. The original question is naive to begin with, and your comments following it have not been much more insightful or requiring of response. FB is on the bleeding edge of performance, a place that is specifically experimental. If you believe you have the answers to the problems they face, submit a resume.
  • Jared Farrish
    Jared Farrish over 13 years
    I agree in a way that in certain cases it's true, but this is such a special case. Why did Yahoo hire Douglas Crockford to work on YUI? Maybe more than corporate competitiveness goes into why some decisions are made.
  • Jared Farrish
    Jared Farrish over 13 years
    I think there is truth in this answer.
  • Ricardo Tomasi
    Ricardo Tomasi over 13 years
    If they have a million lines of their own code, they will have to test it anyway. And open-source libraries like jQuery are tested by millions, besides automated testing.
  • Ricardo Tomasi
    Ricardo Tomasi over 13 years
    @Mike that doesn't make sense. Caching works the same for any js. For efficiency, it's hard to beat code that has been in development for 5 years, I doubt that's a reason. It's probably all about control...
  • Ricardo Tomasi
    Ricardo Tomasi over 13 years
    This makes me cringe. There's nearly nothing to exploit in JavaScript because it has NO security! It already runs in your own browser, you can tamper with the code as much as you like, open-source or not the code is fully visible to you. And you got it backwards: security by obscurity never works, and open-source code is generally more secure precisely because the codebase is known.
  • stealthyninja
    stealthyninja over 13 years
    @Ricardo Tomasi: Does my entire answer make you cringe or just the part that brought about this knee-jerk reaction at the mention of open source software in connection with security? "Security by obscurity" on its own is obviously no real security, it's yet another layer in what one would hope to be a multi-layered system.
  • Ricardo Tomasi
    Ricardo Tomasi about 13 years
    Just the second part, "if everything you work on is open source and publicly available, so are the bugs and inherent weaknesses". That's a strength. I have seen this argument a few times from clients "afraid" of using jQuery because it's open-source :/ Instead they want a completely new/rewritten library in a week, that obviously ends up slower and buggier.
  • Nojan
    Nojan over 11 years
    i think the number 7 is most likely. and i will be surprised if they don't have a framekwork. jQuery comes with lots of features that facebook may won't need most of'em. and when it comes to billions of page loads in a day, each byte counts! and the rational thing to do is to have a framework that bring the exact amount of functionality that is needed. nothing less and nothing more
  • Rey
    Rey about 7 years
    I think the most correct one here is number 7
  • skrilled
    skrilled over 5 years
    ReactJS is better than anything else on the market (today, right now) and took market share because of it. They were in fact too good to use other frameworks after all.