Live data from Hacker News

Facebook PHP Source Code from August 2007

gist.github.com

31–40 of 99 posts

Re: Facebook PHP Source Code from August 2007

#31
post #19

I know it's just two of the files, but taking into account the rest of the pages for the FB app in 2007, it does not seem like a lot of code. One or two people could have written and maintained a project that size. What were all the new hires doing from 2005-2007?

The company wasn't very large at that time. Probably less than 100 engineers in 2007. One person could understand the bulk of the codebase in a a reasonable amount of time.

There was way more code than you're seeing here though, note all the includes at the top.

Re: Facebook PHP Source Code from August 2007

#32
post #28

Can someone explain to a newbie why this code is so bad? Reading through it it seemed to generally make sense and not be too complicated.

The lack of `chroot`[1] makes me sad off the bat - for some reason that function seems like a secret, everyone actually wants to use it (or wanted to before autoloading became as easy as it is) but nobody did. Additionally I'd love to see that file split up into smaller chunks simply to lower the scope of thought. It looks like nearly all of those function calls are modifying variables passed by reference instead of…

`chroot()` has no place in a web application. The system call requires the process to be running as root.

Re: Facebook PHP Source Code from August 2007

#33
post #2

It wasn't actually stolen as it says in the README. It was a misconfigured Apache server which leaked raw, unprocessed PHP code. I received the code to home.php and profile.php but I didn't save it at the time (I was very very new to learning PHP and didn't realize the significance of what I was looking at). Still really cool to see.

I want to be clear: I don't care, and I doubt Facebook cares.

But legally, I think this code was stolen. Facebook owns the copyright to the source code, so copying and distributing is theft in the same way that copying and distributing database contents is theft.

But again:

Re: Facebook PHP Source Code from August 2007

#34

I always liked Nik's comments and was wondering why he had stopped posting here. https://news.ycombinator.com/threads?id=nikcub https://www.zdnet.com/article/security-consultant-granted-ba... https://www.zdnet.com/article/goget-hacker-sentenced-to-400-...

I always find this kind of stuff interesting. Albert Gonzales broke into a bunch of my work's servers (for years) at my first job, after a customer of ours pissed him off. I had some AIM coversations and lurked/logged in one of his advertised IRC hangouts. Most of the transcripts went to the secret service, which was very interested in his Credit Card fraud activities (as advertised on IRC).

https://usa.kaspersky.com/resource-center/threats/top-ten-gr...

Re: Facebook PHP Source Code from August 2007

#35
post #2

It wasn't actually stolen as it says in the README. It was a misconfigured Apache server which leaked raw, unprocessed PHP code. I received the code to home.php and profile.php but I didn't save it at the time (I was very very new to learning PHP and didn't realize the significance of what I was looking at). Still really cool to see.

I want to be clear: I don't care, and I doubt Facebook cares. But legally, I think this code was stolen. Facebook owns the copyright to the source code, so copying and distributing is theft in the same way that copying and distributing database contents is theft. But again:

Your definition of theft is wrong. Legally, this was not stolen.

Re: Facebook PHP Source Code from August 2007

#36

Earlier quoted context omitted.

I didn't read it carefully and I don't know much PHP, but is the code really that bad? There's all kinds of worse code out there running everything. As long as it's relatively well organized, you can worry about refactoring as you scale up.

I used to know PHP, and this code is very indicative of the imperative style that was popular during that era. I believe the PHP crowd has mostly gone deeply into OOP. With that said, Facebook mostly worked remarkably well. My bank, on the other hand has their web presence written in Java. And it works about 80% of the time. Sometimes one just has to try twice. So, "good code", "bad code" will always take a back seat…

I guess what's really at play is whether or not the code is sloppy because the developers are making a conscious decision to not refactor yet, or it's sloppy because they don't know what they're doing.

I've found lots of great developers write huge, sloppy, 300 line methods, if it gets the job done. I love clean code, but too much abstraction is a liability unless there's a good reason to introduce it. Part of expertise is knowing when it's okay to break the rules.

Re: Facebook PHP Source Code from August 2007

#37

Earlier quoted context omitted.

I didn't read it carefully and I don't know much PHP, but is the code really that bad? There's all kinds of worse code out there running everything. As long as it's relatively well organized, you can worry about refactoring as you scale up.

I used to know PHP, and this code is very indicative of the imperative style that was popular during that era. I believe the PHP crowd has mostly gone deeply into OOP. With that said, Facebook mostly worked remarkably well. My bank, on the other hand has their web presence written in Java. And it works about 80% of the time. Sometimes one just has to try twice. So, "good code", "bad code" will always take a back seat…

So the bank would be better of with php?

Re: Facebook PHP Source Code from August 2007

#38
post #35

Earlier quoted context omitted.

I want to be clear: I don't care, and I doubt Facebook cares. But legally, I think this code was stolen. Facebook owns the copyright to the source code, so copying and distributing is theft in the same way that copying and distributing database contents is theft. But again:

Your definition of theft is wrong. Legally, this was not stolen.

Are you a lawyer?

Re: Facebook PHP Source Code from August 2007

#39
post #2

It wasn't actually stolen as it says in the README. It was a misconfigured Apache server which leaked raw, unprocessed PHP code. I received the code to home.php and profile.php but I didn't save it at the time (I was very very new to learning PHP and didn't realize the significance of what I was looking at). Still really cool to see.

I want to be clear: I don't care, and I doubt Facebook cares. But legally, I think this code was stolen. Facebook owns the copyright to the source code, so copying and distributing is theft in the same way that copying and distributing database contents is theft. But again:

Copyright infringement =/= Theft.

Re: Facebook PHP Source Code from August 2007

#40
post #15

Amazing that they initially wrote this code and now to join FB you need to answer questions based on backtracking and dynamic programming. :) I wonder if they could do the questions themselves back then.

Dynamic programming questions are explicitly not used in current Facebook interviews. From time to time, Facebook and other companies study the effectiveness of their hiring process by comparing employee performance and interview performance. I believe dynamic programming questions were removed because there was not a strong link between success in this question and future performance.

This sounds very counter-intuitive! Did you hear this from someone working at Facebook or did you read it online? If it's the latter it'd be great if you could share a link!
Post reply on HN