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.
Facebook PHP Source Code from August 2007
51–60 of 154 posts
Re: Facebook PHP Source Code from August 2007
#52Earlier quoted context omitted.
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.
Shipped code > Well architected incomplete features. Actually there is more wisdom hidden in this dogma. I'd argue you can't really well architect anything without iterating running code. So, it's more of a cycle. At least in my case. Proto, use, profile, refactor, proto new stuff into it, use, profile, refactor...
Sometimes (not always), it's best to release when ready. Shipping is important for a company, but for a dev team/individual it should be further down on the list and more importantly, development is not done after the first release and features don't maintain themselves.
I don't like the whole 'ship as soon as possible'-thing.
Re: Facebook PHP Source Code from August 2007
#53Re: Facebook PHP Source Code from August 2007
#54Earlier quoted context omitted.
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.
It'd be somewhat weird to stumble across comments in that code. // TODO:
The best I've seen are (when reading DNA translated in all frames):
EVQLVE
LAMARCK
ELVISISGAY
SALTYSATAN
Re: Facebook PHP Source Code from August 2007
#55Does anyone else remember the friend graph visualization feature facebook used to have? It was an oddity, both because it seemed like a strange but useful feature, but also because it was a perl script. One time I clicked it and got the source code to the file instead of the graph. It's somewhere on one of my hard drives, but it seems wrong to leak, especially since it has database credentials hard-coded into it.
// NOTE: ok, at this point we know we are going to display the full // page, so it is time to do a PHATTY PHATTY MULTIGET of all the shit that // we are going to need to make this page, or at least the most common things
// Clear fire if desired
Re: Facebook PHP Source Code from August 2007
#56Hehe, these lines made me chuckle. // Holy shit, is this the cleanest fucking frontend file you've ever seen?! ubersearch($_GET, $embedded = false, $template = true); In all seriousness though, I wonder how much of this was written by Mark Zuckerberg?
Re: Facebook PHP Source Code from August 2007
#57Earlier quoted context omitted.
It doesn't say it's 100MB per request, just that it's raised for safety in the rare case where it's actually needed. Would you prefer serving a 500 to that user instead?
I can't think of a single reason a PHP script like this would need that much memory to serve a single user. Everything big would be handled by the database, what could 500MB possibly be used for?
Re: Facebook PHP Source Code from August 2007
#58Earlier quoted context omitted.
A 100MB per request is going to seriously limit scalability (or inflate hardware costs at least)
It would seem that Facebook has been able to scale. Perhaps this line of code worked for them in 2007, and they changed it only when it started to be a problem.
Re: Facebook PHP Source Code from August 2007
#59Does anyone else remember the friend graph visualization feature facebook used to have? It was an oddity, both because it seemed like a strange but useful feature, but also because it was a perl script. One time I clicked it and got the source code to the file instead of the graph. It's somewhere on one of my hard drives, but it seems wrong to leak, especially since it has database credentials hard-coded into it.
managed to save a copy of several files that appeared at the time - home.php, album, group, friends, photo, profile, readmessage ... code was an interesting read, as were the comments in it: // You fucking link h4x0rs just got pwned // Shortcut out of this CRAZY expensive garbonzle // What did we come up with? // don't display the Tuna album (aid=-1) // is this group a dummy meant to populate newsfeeds? // do not lis…
// make sure big tunas haven't moved around