Hacker News new | ask | show | jobs
by lukev 5055 days ago
I guess someone must really love PHP, though I'm slightly confused as to why.

If you're going to make such a massive undertaking anyway (it's not just the new runtime, all existing code will have to be re-tested and re-debugged), why not sink the man-hours into putting it into a new language better suited to the task from the start?

3 comments

Because there are millions of man hours of PHP from FB and it will cost less than one hundred thousand to port that work to the JVM.

Yes the code will have to retested, but if you rewrite then you rewrite AND retest. Working code makes a great test suite, something you lose in a rewrite.

Yes, that sounds fine (and I'm aware of the Spolsky article posted in another comment.)

But the fact is that a system of that size simply must already be split up into discrete services or components. (If it's not, then that should be their first priority. But I can't imagine Facebook is running everything they do out of one process).

So they could port each service/component one at a time, rigorously testing and improving performance as they go. Then they'd not only get the benefit of a better runtime, but also a safer, faster language. In fact, if they're anything like most companies I know, they're always in the process of rewriting one service or another to improve performance or features, whether in a new language or not. All they'd need to do would be to switch to the new language whenever they were refactoring existing code anyway.

Of course I can't make the decision for them, and they are rightly hesitant to do an entire rewrite. But it seems like they're going to fairly extreme lengths to stay with PHP.

> But the fact is that a system of that size simply must already be split up into discrete services or components.

Come on, they created Thrift, I think we can assume they use it?

i understand your thinking but in your opinion what language is suited for this particular task? personally i doubt there's a platform that's suitable for this scale, one has to create his own, and thats what facebook's doing.
This is where someone posts the Joel on Software link about Netscape (I'm on my iPhone else I would).

Also, developing a new implementation of PHP allows site development to continue in the meantime.

I agree with Joel about a lot of things but I don't think history lines up with his famous comments about the Netscape rewrite. Netscape was well on the decline before they began the rewrite and its problems were more lack of commercial focus (eg. their failed attempts at "groupware") rather than the technical decision to rewrite Navigator. And without that rewrite it is unlikely that Firefox would have ever existed and without Firefox, Netscape (now Mozilla) would have slid into the abyss of irrelevance a long time ago.

So while there are certainly good arguments to be made that rewrites can bite you in the ass and should often (though not always, IMO) be avoided, I wish people would stop referencing Joel's circa-2000 post unless they are willing to rewrite it in hindsight and still attempt to make his argument.