richardoneill.com.au » Articles » Facebook Code Analysis

Facebook Code Analysis

16 August 2007 PHP, Programming, Security

Facebook Code Analysis

Most developers have now heard about Facebook's leaked index.php source code, which was anonymously posted here. If you haven't seen it already, there are a number of links listed on Techcrunch.

I've seen a few bloggers criticize Facebook developers for using procedural programming rather than classes and object oriented techniques. I'm not exactly sure why they've chosen to develop the site like this; but I am going to take a guess and say it was to improve speed and efficiency.

Object oriented programming was first introduced to PHP in version 4. However, the language wasn't originally designed around objects and classes, so the implementation was clunky and awkward. This meant that procedural code was often much faster than object oriented code.

Considering the size and popularity of social networks, I'm not surprised they chose procedural code over objects. That tiny boost in performance would easily outweigh the advantages of using classes.

Fortunately, most (if not all) issues with objects have been solved in PHP 5, which is now closer to a truly object oriented language.

Comment on this article
Name
Website
Canberra Web Design