Live data from Hacker News

Facebook PHP Source Code from August 2007

gist.github.com

21–30 of 154 posts

Re: Facebook PHP Source Code from August 2007

#22
post #11

I 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

#23
This is why I was saying evented webserver code is better.

Look 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

#24
post #11

I 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.

Yup.

Shipping is a feature.

Re: Facebook PHP Source Code from August 2007

#25
post #11

I 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.

Yeah, and because the code is completely undocumented and obfuscated it's taking us biologists a few hundred thousand man-years to figure out what the hell it means. The only time spaghetti is a good thing is when it's covered in sauce.

Re: Facebook PHP Source Code from August 2007

#26

This 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

#28
post #13
post #8

When 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.

Doesn't quite hold true once you get done to hand written and optimised binaries though. There's no way of making assembly easily readable to everyone, no matter how relaxed the developer.

Re: Facebook PHP Source Code from August 2007

#29
post #26

This 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

I don't think even HPHPc was around in 2007. Development didn't begin until 2008, IIRC.

Re: Facebook PHP Source Code from August 2007

#30
post #20
post #16

Earlier 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…

I must admit my comment was unneccessarily bitter, but my observation is completely different. Many friends and family members are now seeing data loss on Facebook weekly at least. I wouldn't call them tech savvy either, yet they can attribute the issue to Facebook, after having learnt the simplest basics of how the web should actually work.
Post reply on HN