Why does Facebook use the PHP programming language?
PHP implements a fly-through from designing a Web site to writing a Web application, but with a small investment, you don't have to be a professional to do it at all.
When Japanese computer scientist as decided to create a programming language called Ruby, which supported Twitter, Hulu and many other modern web sites, he was inspired by a 1966 sci-fi film called BABEL-17. The book is mainly about a newly invented language that allows those who use it to upgrade their minds. "BABEL-17 is an extremely accurate analytical language that almost ensures technical advantage in any situation. "The protagonist in the film has such a line. By inventing Ruby, as wants to do the same: re-invent and improve the way programmers think.
The goal sounds ambitious, but his idea is a mainstream one. Software developers are a type of job, and it's generally thought that programming language has an impact on thinking, big enough to change the way you solve problems-even the ones you choose to solve. This is how they expand the size of their company, improve their products, and recruit teams: "What programming language do you use?" ”
Understanding this makes it possible for outsiders to understand the workings of software companies, especially as they become so powerful and profitable that the products and services they produce come into all corners of our lives today. If you want to know why Facebook looks and works the way it is now, what Facebook can do for us or for us in the future, you need to know something about PHP, because this is Mark Zuckerberg's first build The program language used by Facebook.
Among programmers, PHP is probably the least "looking up" of all programming languages. Someone in a blog post evaluates it as a "bad design", while those who are willing to use PHP are considered amateurs. "There's this legendary thing, the top engineers who work on Facebook, who write PHP code on Windows XP," says Jeff Atwood, founder of the program quiz site Stack Overflow. "They're the kind of hackers who ruin the third level." "In the last 10 minutes of the conversation, Jeff described PHP in the following words:" A wasting Beast "," A Plague ", a haunted house in which the guests fell in love with the Wraith.
Most of the recognized programming languages have a general design philosophy or guidelines for organizing keywords and grammars-that is, the set of instructions to be used by programmers-and form a logical whole. PHP does not. Its designer Rasmus Lerdorf voluntarily admitted that he was patchwork. "I don't know how to stop," he said in an interview in 2003, "I don't even know how to write a programming language-I just add a new logic module with one side." ”
A programmer's favorite example is the PHP function "Mysql_escape_string", which can remove a mixed character and then commit the database. (Mixed character examples can refer to the general website will ask you to enter an email address, such as hackers can embed a piece of code, from the site to obtain your password.) When a vulnerability to this function is found, a new version appears, called "Mysql_real_escape_string", but the original version is not replaced. The result is as if there were two close-fitting buttons on the cockpit, one for putting down the landing gear and the other for putting the landing gear safely down. This is not a friendly operation-it is the cause of the disaster.
But despite the widespread disdain for PHP, many of today's web networks are based on PHP design, with 39% of Web sites using PHP. Facebook, Wikipedia, and WordPress are all PHP projects. This is because PHP has a lot of flaws, but it's quick to get started. The name PHP comes from the original "home page", which makes it easy for users to add dynamic content such as dates and usernames to static HTML pages. PHP implements a fly-through from designing a Web site to writing a Web application, but with a small investment, you don't have to be a professional to do it at all.
The "instant-on" nature of PHP is critical to Wikipedia's success, says Ori Livneh, the Wikimedia Foundation's chief software engineer. "I've always hated PHP," he said to me. Wikipedia relies too much on PHP, leading to large-scale design flaws. (This is why it was not until 2008 that Wikipedia launched the mobile version until the 2013 editing interface became friendly.) But PHP lets those who are not-or almost just-software engineers can submit new features: That's why Wikipedia entries can display hieroglyphs on the Ancient Egyptian civilization page and can handle staff.
But you can't design Googlewith PHP because Google is the one thing Google needs to do best-search results. Google is designed to be more refined and powerful languages such as Java and C + +. Facebook, on the contrary, is more like a series of small experiments: buttons, information flows, informational modules, etc. just to catch your attention. PHP was born to make new things fast.
You can imagine Zuckerberg completing the Facebook scene at a Harvard dorm. The Internet has developed so fast, the user is changeable, the only way to seize the opportunity is fast. Whatever he does is a piece of mud, or a dish of spaghetti, or even anything good. He made the things that people could use. He did not consider the question of elegant code, but what he wanted was for friends to visit theFacebook to see pictures of the girls they knew.
Facebook is now a $200 billion company, and the office is full of slogans that "it's more important to be done than perfect"; "Fast forward, break the routine". This is Facebook's "hacker" culture, but it's exactly PHP's values. Fast-moving to break the routine is really the essence of PHP, and anyone who uses that language will think like that. You may say that it is this programming language that builds and sustains the culture of Facebook.
At the end of 2010, Facebook ushered in a crisis. PHP is not a performance-optimized design, but now requires performance improvements. Facebook is growing too fast and looks likely to be problematic without major tweaks.
The overall Change program language is not an option: Facebook has millions of lines of PHP code, thousands of PHP engineers, and over 500 million users. Facebook's approach is that a small team of senior engineers is assigned to a special task. One of them is to design a compiler that translates Facebook's PHP code to run faster C + + code. Another task is done by computer-language experts who want Facebook programmers to keep their PHP-style culture, but write more reliable code.
So a branch version of PHP Hack came into being, this language is PHP with an optional type system. In other words, you can quickly write PHP code in an old-fashioned way, or choose to have the type system check your code for accuracy. Facebook wants their programmers to continue to move quickly in their familiar language, but doesn't want them to break things like they did before. (last year Zuckerberg announced a new engineer slogan: "Fast-forward, stable architecture".) )
When startups finally solve their revenue problems and become "mature," they can intelligently use the power of programming languages to manipulate the culture of corporate organizations. Guido van Rossum, a 7-year-old program language designer at Google, Mulberry that the only way for a software company to grow to a certain size and solve the mess is to use a language that requires programmers to do more work on the frontline. "It feels like you're being slowed down, because you have to say everything three times. "That's why many startups want to wait as long as possible before they change their language." You'll lose some of the first-chance hackers that helped you get started, and you'll lose the possibility of small teams raiding new features. But a more precise language will help other people in the company understand each other's code and gain product stability, which is essential for the company's daily operations.
The ability of software startups to make this adjustment may help explain why they are so powerful. The same is true of the areas of computer misconduct expansion. These software companies also have the unique ability to re-build themselves. As they evolve and evolve, they can do more than just organizational adjustment, because they are based on code design, so they can achieve even greater changes. They can re-compile themselves, their culture, and the way they think.
http://www.bkjia.com/PHPjc/980582.html www.bkjia.com true http://www.bkjia.com/PHPjc/980582.html techarticle Why does Facebook use the PHP programming language? PHP implements the leap from designing a Web site to writing a Web application, but with little input, you don't need to be a professional ...