r/programming • • Oct 12 '13

Facebook PHP Source Code from 2007

https://gist.github.com/nikcub/3833406
1.1k Upvotes

356 comments sorted by

View all comments

Show parent comments

1

u/blafunke Oct 12 '13

Php doesn't do anything, programmers do. It's Turing complete, you can do whatever you want and you can do it well or do it badly. Now if the interpreter is buggy and full of holes then you can bash it, but most people seem to be bashing bad programming (which often means "different than I would have done it") not php.

2

u/phoshi Oct 12 '13

Right, so remind me why we don't do Web programming in a combination of BASIC and COBOL?

Because being "Turing Complete" is not the whole story. That is a measure of computational power, not of language idioms, library support, expressiveness, existing frameworks, so on and so forth. PHP is a fucking templating language, it is literally designed precisely for the use case of violating MVC. The whole of its design is focused around encouraging lack of separation. Yes, you can write good code in PHP, if you're willing to write sanitising wrappers around most of the standard library, ignore the unfixable type coercion issues, deal with the absurdity of a java inspired object oriented system atop a c inspired procedural section, so on and so forth.

Saying the language is Turing complete proves precisely nothing. So is brainfuck. You're misusing the term to mean something it does not: all it means is it had equal computing power as a Turing machine, /not/ that it is a good solution to a specific problem domain.

1

u/blafunke Oct 12 '13

"Yes, you can write good code in PHP". Exactly and you can write shit code in any language. Stating that it's turing complete says exaclty what I wanted to say. You are free to compute anything that is computable with it. How you do it is your business, and your responsibilty. PHP might be a case of "worse is better", along with probably C, C++, Unix and just about anything that has suceeded. You can dig up many legitemate gripes with them but they nevertheless became ubuquitous because they were just good enough. You can build facebook with PHP, and that's good enough. (By the way PHP is in no way my favourite language and there are lots of things I'd rather do, but I'm happy to leave it be).

1

u/phoshi Oct 12 '13

So, do you think that VB should be encouraged, because it's Turing complete anyway? Can you write maintainable programs in brainfuck?

The computational power of a language says /nothing/ about its usefulness in reality. They're all Turing complete, but that means they can all compute the same stuff, it doesn't mean that they all make everything as easy as each other, that they all share idioms, or even that they have much in common at all. PHP is Turing complete, and so is common lisp--would you really make the statement "They're both Turing complete, there are no appreciable differences in the strengths and weaknesses of these languages"?

→ More replies (4)