Why Hasn't Facebook Dumped PHP Yet?


Why Hasn't Facebook Dumped PHP Yet?

Bangalore: So it is common knowledge that Facebook started out with PHP.  Sure, PHP is one of the world's most popular programming languages, but it is old. So why hasn't the world’s most popular social network switched languages to adopt Python or something more versatile?

Although it would be a pain to change everything from scratch, the most inevitable urge is to at least ask how the 845 million-strong network put up with the language for so long anyway.

Yishan Sparklepants Wong, a Facebook engineer who worked at the company from December 2005 (the company was founded in February 2004) and March 2010 answered the question on Quora, a website that allows you to ask questions and get connected to content.

According to Wong, “The reason Facebook hasn't migrated away from PHP is because it has incumbent inertia (it's what's there) and Facebook's engineers have managed to work around many of its flaws through a combination of patches at all levels of the stack and excellent internal discipline via code convention and style”.

He says that the worst aspects of the language are coded around and avoided, while coding style is rigidly maintained by means of a strict culture of code-review by one’s peers. "The preferred strategy”, he wrote, “is to write new components in a de-coupled manner using a better language of choice (C++, python, Erlang, Java, etc); this is easily facilitated by Facebook's early development of thrift, an efficient multi-language RPC framework”.

The overall effect boils down to the overall codebase slowly evolving away from depending heavily on PHP, and components written in PHP being tightly-controlled, by veteran members of the staff in disciplined ways.

In any case, the overall rule seems to be “if it’s not broken, don’t fix it”, and it seems to work well for Facebook.