if($user 0 && !is_unregistered($user)) { return $user; }Facebook PHP Source Code from August 2007
21–30 of 154 posts
Re: Facebook PHP Source Code from August 2007
#22I think there is a valuable lesson to be learned from this piece of spaghetti. I can't quite formulate it from the top of my head. But it's something like: if you wanna be rich, don't waste your time being pedant - your users couldn't care less.
We seem to be doing all right.
Re: Facebook PHP Source Code from August 2007
#23Look at how much I/O is happening one after the other. The latency could be greatly reduced by doing things in paralel and waiting until all the promises resolve.
Re: Facebook PHP Source Code from August 2007
#24I think there is a valuable lesson to be learned from this piece of spaghetti. I can't quite formulate it from the top of my head. But it's something like: if you wanna be rich, don't waste your time being pedant - your users couldn't care less.
My mantra: Shipped code > Well architected incomplete features. Your user does not care in the slightest if you're using a design pattern, or if you are using dependancy injection, or if there is 100% code coverage. Just make it work! Then make it faster! Then make it more readable! In that order.
Shipping is a feature.
Re: Facebook PHP Source Code from August 2007
#25I think there is a valuable lesson to be learned from this piece of spaghetti. I can't quite formulate it from the top of my head. But it's something like: if you wanna be rich, don't waste your time being pedant - your users couldn't care less.
all of computer science was created by an undocumented spaghetti code that evolved over a few hundred million years: DNA is 700 MB or so of uncompressed undocumented base pairs. We seem to be doing all right.
Re: Facebook PHP Source Code from August 2007
#26This looks weird in search.php (line 89): if($user 0 && !is_unregistered($user)) { return $user; }
$ php -r '$user = null; if ($user 0) { echo $user; }' PHP Parse error: syntax error, unexpected '0' (T_LNUMBER) in Command line code on line 1
Re: Facebook PHP Source Code from August 2007
#27line 72: // Holy shit, is this the cleanest fucking frontend file you've ever seen?!
Re: Facebook PHP Source Code from August 2007
#28When I see code like this, I'm always amazed that I can actually read it and (kinda) understand what it's doing. I always expect code like Facebook's to be so finely tuned and advanced that it'd be completely uninteligable to those outside the company and not an expert in the language.
In my experience code become unitelligable not because it's fine tuned and advanced but because it's messy and rushed.
Re: Facebook PHP Source Code from August 2007
#29This looks weird in search.php (line 89): if($user 0 && !is_unregistered($user)) { return $user; }
This is either a syntax error or a HipHop idiosyncrasy (was HHVM in use in 2007?) $ php -r '$user = null; if ($user 0) { echo $user; }' PHP Parse error: syntax error, unexpected '0' (T_LNUMBER) in Command line code on line 1
Re: Facebook PHP Source Code from August 2007
#30Earlier quoted context omitted.
... unless your users actually care about messages being delivered, whatever being reported as saved being truly saved, et cetera... There is a whole world out there where people want to rely on software to do what it says it does. I know Facebook can live in its own bubble and get away with every possible stupid bug a messy PHP spaghetti causes.
I remember listening to an interview with Markus from Plenty of Fish, where he essentially said that he didn't worry too much about site errors because most unsophisticated users would attribute them to things like their ISP, browser (if they knew what that was), or their own error more often than to the site itself. Personally, I can't bring myself to not care like that, but it seems to have worked pretty well in th…