News for hackers. Stuff that matters.
Re:Facebook PHP Source Code from August 2007 by javis on Saturday October 12, 2013 @08:36AM (#6538497)
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.
Re:Facebook PHP Source Code from August 2007 by Joeri on Saturday October 12, 2013 @09:35AM (#6538683)
Actually, a large codebase can be reasonably expected to live 20 years. Over that time with a lowish 10% turnover you'll replace the entire programming staff twice, so the understanding people have of the code is not just hearsay, but hearsay of hearsay. The sheer size of the codebase (facebook has tens of millions of lines of code) means that practically speaking you can't program your way out of a corner once you get there. That is (partly) what killed facebook's competitors. The solution to all of this is to be ruthless about simplifying code. The goal of new code should first and foremost be to be maintainable. Clever code is the enemy of scaling a programming team. Not that you don't need clever code, but you isolate it and protect it and make sure the average team member doesn't have to look at it.
Re:Facebook PHP Source Code from August 2007 by Kiro on Saturday October 12, 2013 @08:43AM (#6538515)
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 by moconnor on Saturday October 12, 2013 @09:26AM (#6538649)
Or over-generalized with the logic split up and hidden in the interactions between a dozen (sub)classes.
Re:Facebook PHP Source Code from August 2007 by oneeyedpigeon on Sunday October 13, 2013 @05:52AM (#6542031)
Or under-generalised with the logic duplicated in a dozen places, ever-so-slightly differently
Re:Facebook PHP Source Code from August 2007 by nwh on Saturday October 12, 2013 @09:20AM (#6538627)
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 by moconnor on Saturday October 12, 2013 @09:28AM (#6538656)
Hand-written assembly can be just as readable as any other language. See https://github.com/jmechner/Prince-of-Persia-Apple-II/blob/m... for a good example!
Re:Facebook PHP Source Code from August 2007 by wmil on Saturday October 12, 2013 @01:36PM (#6539490)
You shouldn't be. Ultra minimalist code using every language feature tends to be difficult to understand and maintain. It's usually written by young coders eager to show how clever they are.
Re:Facebook PHP Source Code from August 2007 by Nitramp on Sunday October 13, 2013 @10:07AM (#6542623)
It's the exact opposite. The better code gets quality wise, the easier it gets to read and understand.

There are situations that require using somewhat surprising language features occasionally, but quality code will limit them to small areas, and document the hell out of what's going on there.

Re:Facebook PHP Source Code from August 2007 by UK-AL on Saturday October 12, 2013 @10:06AM (#6538769)
The best code, is often the easiest code to understand.