5 ms·
This piece of code is doing something very simple and sequential in nature: putting together the (then) Facebook front page. I'm not sure I agree it's spaghetti
by TelmoMenezes 13y ago
This piece of code is doing something very simple and sequential in nature: putting together the (then) Facebook front page. I'm not sure I agree it's spaghetti. Are there any complex relationships that become hard to follow because of an inadequate level of abstraction? It doesn't look that way to me.
Many programming methodologies are proposed these days, but the entire "field" smells of pseudo-science. Unless studies are done that can show statistically significant differences in relevant metrics (defect density, time required to add a feature, etc.), it's just a matter of opinion.
- a1a 13y agoYou make a fair point and I guess everything is relative. My post was not meant to trash the code, but rather to point out that this code shows us that the primary objective shouldn't necessarily be writing the perfect code.
- TelmoMenezes 13y agoOops sorry. Ok, we agree!
- 7Figures2Commas 13y ago> My post was not meant to trash the code, but rather to point out that this code shows us that the primary objective shouldn't necessarily be writing the perfect code. That's a dangerous argument. I mean, if startups stopped pursuing the most elegant code, they wouldn't need, nor would they be able to hire, the "best" developers. And then what? 1. Lots of startups would be able to get off the ground and grow with less cash because they wouldn't have to pay six figures to every developer on staff. 2. It would be a lot easier to find acceptable candidates (no more "you have five minutes to implement sort on a whiteboard...to prove that you can build a web form" challenges during interviews). 3. There would be a lot less premature optimization and use of the framework or NoSQL database du jour. 4. Egos would be hurt as engineers with the most impressive educational backgrounds and deepest technical expertise would be forced to come to grips with the fact that, while they are valuable and have a big role to play at some companies, people with less formal training and knowledge can build working, commercially-viable CRUD applications. This would be the end of the Silicon Valley startup world as it exists today, I tell you!
- pault 13y agoI was halfway through my rebuttal of your comment before I realized it was satire. Well done. :)
- asveikau 13y agoIt's kind of funny to see two reactions here: * Reaction A: code is ugly, what a bunch of jerks! * Reaction B strikes me a bit as hero worship. Since we already know the outcomes, already some consider them geniuses; we must conclude every decision they made was a good one, and there is no room for criticism. Perhaps neither are great, but I think reaction B especially is a little dangerous. One must acknowledge that there are more factors to your success than coding style, but that doesn't mean if you start neglecting it then it will also lead to your success.
- wizzard 13y agoA false dichotomy if ever there was one. Anyone who doesn't think the code is ugly must just be blinded by hero worship? How about the possibility that a1a is one of the people who just automatically equates "large volume of code" with "spaghetti"? In my experience there is a fair number of HN users (and devs in general) with this knee-jerk perspective. In my very humble opinion any reasonable person who takes a few minutes to actually read through this code would never call it spaghetti. _Especially_ considering 1) the feature set of PHP at the time the code was leaked, 2) the immense scale of Facebook even at that time.
- a1a 13y agoIt's almost like you are trying to misinterpret my post. Large volume of code? The site displays roughly 600 lines of code, is this a large volume of code to you? Like I posted - just below - a day before your post: "My post was not meant to trash the code, but rather to point out that this code shows us that the primary objective shouldn't necessarily be writing the perfect code."
- jeff_facebook 13y agoI agree about programming methodologies being pseudo-science, so I'll defer to something much simpler and less cynical -- the vague wisdoms of Unix Philosophy: "Rule of Representation: Fold knowledge into data so program logic can be stupid and robust." This code violates this rule horribly and is quite deserving of the label "spaghetti code".