How did Zuckerberg code Facebook so fast?I could have coded websites like the initial version of FB in days, not weeks. Most websites start out pretty simple and back in those days it was very easy to start up a Linux/Apache/MySQL/PHP environment. Even if I were going to host the server in my dorm room, it wouldn't take me more than an hour or so to get a new machine set up.
Then for the data schema, it starts out pretty clean and easy for a relational system. I'd have tables such as user, user_profile, user_posts, user_friends, user_friend_requests, etc.
Then for the code, it's basically all create, read, update, and delete to/from these tables. Of course, I'd do all of the standard stuff like one way encryption for password storage (using SHA1 or something like that), etc.
All of this stuff would have gotten me a basic facebook system up and running within one day (typically one night).
I'd also build in some admin tools to look up users, reset passwords, etc.
Once I get some real users on the system, you have the hard part...scaling. This is when I'd split up the servers into multiple servers, eventually set up MySQL in a multi-server environment (single write, multiple reads), etc. Eventually these will become java services and each service is run by a team of engineers, etc. And of course another hard part is security.
As users increase, I'd spend most of my time writing code for new features and to clean up existing features but also spend more time on scaling (evaluating and probably moving to nginx, etc.).
When I was consulting at a consulting company, I one time singlehandedly built an e-commerce website in 2 weeks. The client approached our company and said that they were in a time crunch and needed a system up and running in 2 weeks. The company knew I was the only guy who had a chance to pull it off so they asked me. I shrugged and said "Yeah, I can do that" and a week later, we were internally testing the e-commerce site. It was fairly basic but it had a catalog, shopping cart, user accounts, checkout flow, credit card integration, etc. That client did piss me off though because they asked for a lot more features after they saw the initial version that I made for them in a week and I basically said no...because I wanted to spend the 2nd week testing and fixing bugs while their logic was that since I did all this in a week, it shouldn't be a problem to do all this other stuff. I had a graphic designer do the html though.
Most websites (facebook, quora, stackoverflow, gmail, ebay, etc.) aren't hard to create their core basic features but then many features get added and polished, etc. They then build on network effects which I wouldn't have by simply copying their core elements. You have to be quick to market (usually not first to market but early enough). And then there are some websites that are actually kind of hard to build. A search engine comes to mind because I'd have to build a crawler and it will work but probably won't be all that great so my search results won't be so good, etc.
I get asked on a regular basis from friends and others to build them a website that does X. 99% of the time I can build the core features from a back end functional perspective within a week or two. But 99% of the time, I feel that the idea is stupid (e.g. social network or dating site for (sports fans, job seekers, (insert another niche)).
BTW these days I build these types of sites on Google App Engine using Python and Datastore.
What was written way back when has nothing to do with what exists now. In its original form, every college was separate, every college was on its own database server (in fact at launch, there was only one college and I'm not even sure there were plans in the code for more at the time), and there was no messaging system: you'd just post on your friend's wall.
He built the whole product so fast because he built something simple to a completely usable state and he built it against a small audience. Just for grins, I checked out a very old revision and home.php is 767 lines long. It includes handling group requests, relationship requests, parties, birthdays, and a series of messages about different site features that are displayed using case statements... and that's from 2005 with about 100,000 lines of code. The site was first created in 2004 and it was much smaller.
First of all, he didn't.
The notion that it took him less than two weeks is a lie (and Yishan's confirmation of that lie is meaningless), apparently a lie he told as part of his talk at Y Combinator's 2009 "startup school":
Well, it wasn't as complex at that time as you're thinking :P
Feature-wise there were only 5 things in TheFacebook at the time of initial launch:
- Friend Requests
- Messaging :)
That's it - NO News Feed, No Wall, No Apps and pretty much nothing else that exists in complex Facebook of today.
Its homepage looked something like this at that time (to a logged out user):
Plain and simple: he didn't. The original code was produced by 4 or 5 individuals. It was long time ago and I forgot their names. What they produced they did not consider that MUCH valuable. Zuckerberg took that code, and if memory serves me correctly, he paid off or settle with those guys for a silly sum of money (or more significant sum so they keep their mouths shut forever).
It is not rare for such things to happen. Remember Blackberry? Practically stolen code. Or original XML appliance that was sold to IBM for mere 5 mil, can you imagine? And nowadays Datapower appliance sells for billions and billions.
To round off this discussion, compare the roles of three computer-industry pioneers in the business: Bill Gates, Steven Jobs, and Mark Zuckerberg.
When it was time to implement Microsoft's first big order - the order from IBM for a disk operating system for their first PC which, in effect, launched Gates' company - Bill turned to Tim Paterson and his Seattle Computer Products DOS (SCP DOS). Bill Gates became world famous; no-one remembers Tim Paterson. (See the wikipedia entry on SCP: "Seattle Computer Products") Bill was not a coder; he was a marketer.
Steven Jobs and Steve Wozniak are credited with building the very first Apple computers; Woz exclusively did all the engineering, Steve, the marketing. Jobs was not an engineer; he was a marketer.
From the stories that are written here, it appears that Zuckerberg did at least some of the coding for Facebook.