The (Under) Belly of the Beast

One habit I have when visiting websites is to look at their codebase, both for curiosity and for new/interesting code snippets. Today, I was going through Facebook’s code while playing Mafia Wars and, aside from the sheer volume of code, a few things that sort of surprised me:

  1. Liberal use of onClick="" for basically all links that weren’t form buttons. This is DHTML 4.0 event functionality.
  2. Hundreds of lines of internal stylesheet classes, prefix-named according to a specific user id or session. For Mafia Wars, they preload all the possible classes used for any of the (currently) 3 locations you can explore. It’s never easy to have nice, clean, always external css, especially with a site this massive.
  3. About two dozen calls to external javascript and css files, all from the same server. They must have serious bandwidth

Granted, these aren’t by any means a knock against their coders. I’ve been fascinated by the sheer amount of data that goes between user and server for the Zynga games. It’s a feat in itself to command that much dataflow and event triggers and have a (mostly) stable environment for the user.

Plus, considering how long the site’s been around, there’s a lot of legacy code that’s most likely too difficult to extract to make the site work more efficiently. They would benefit greatly from using a JavaScript framework like jQuery, Prototype or MooTools, but trying to retrofit this into their current framework would be a bear, and quite frankly, is it worth it?

118 Responses to “The (Under) Belly of the Beast”

  1. RALPH says:

    johns hopkins lung cancer

    Buy_drugs without prescription…

  2. TERRENCE says:

    menopause thyroid cancer

    Buy_without prescription…

  3. FREDDIE says:

    diets and blood type

    Buy_drugs without prescription…

Leave a Reply

You must be logged in to post a comment.