4 ms·
I love "x reasons to y" because the point-by-point rebuttals are so fun to write. Here we go! PHP is stupid easy to scale So is every other programming langu
by jrockway 14y ago
I love "x reasons to y" because the point-by-point rebuttals are so fun to write. Here we go!
PHP is stupid easy to scale
So is every other programming language. The hard part is scaling your centralized database. Considering most people using PHP are writing applications backed by a single SQL database, it's a bit disingenuous to call the language "shared nothing". While true, it's completely meaningless and true of literally every programming language ever.
It's like saying, "English makes it really easy to tell love stories."
I won’t need experts – If the event that my new ventures grow and I need to hire on more programmers I do not need the best and brightest to get the job done.
True of any language. I can hire people that are bad at programming any language, cheaply.
The deeper problem is that PHP makes it tough to multiply effort by creating good abstractions, so there is a lot of repetitive grunt-work that's best outsourced to a country where people are happy making five bucks an hour.
It is tied to the web
"PHP doesn't work very well when not serving web pages, so I use it to serve web pages." The tautology department called, they want their tautology department back.
When it fails, it doesn’t fail hard
I am not sure what this means. Each request is handled by a single UNIX process. That's, again, how the author happens to architect applications, not an intrinsic (or unique) property of PHP.
Other languages need a lot of plumbing to handle that.
Citation needed. This is standard CGI that's been around since the 80s.
There are a plethora of frameworks to chose from
That's fine. Again true of any language. Even Common Frickin' Lisp has several frameworks.
Best documentation on the web
The author does not explain why, only that he wishes he could log in with his Twitter account to propose changes. (What ever happened to emailing the author?)
Tons of blogs
True of everything, from programming languages to pictures of cats.
The PHP Community
True of pretty much every language I've ever encountered. Even C.
I like the Perl community best because of the infrastructure that the members build for each other. Want to get an email when your module's tests fail on HP-UX? Someone has built a service for that.
Answering questions is nice, but that's the tip of the community iceberg.
It integrates with everything
I read this as: "PHP has a socket API."
Dynamic typing
I'm just going to quote this one verbatim because I can't come up with anything more hilarious:
“But how do you know if you’re working with an int or a string?” By using your brain. HTTP does not do typing and so PHP does not do (strong) typing for scalars. Quite frankly, it makes complete sense to do it that way. Want an int? Cast the damn thing and stop complaining. Dynamic typing significantly reduces the amount of code you need to write and error conditions you need to check for.
It plain works – Programmer’s have it wrong. The technical solution is not the end goal. Technology should be an enabler. Do you have a wonderful technical solution that doesn’t solve a problem? Bye, bye. PHP solves problems faster, easier and with a lower cost of ownership than almost anything out there. A lot of that is based on “assumptions” (or shortcuts) that PHP takes to solve a problem. Most often those shortcuts work, and the workarounds are very easy to implement (I’m thinking mainly about strict type checking here).
Little does the author know that you can have dynamic typing in any statically-typed language:
/** Immutable scalar value. */
public final class Scalar {
private final Integer intValue; // not int so that "null" is meaningful
private final String stringValue;
public Scalar(String string) {
stringValue = string;
}
public Scalar(int i) {
intValue = new Integer(i);
}
public String toString() {
if (stringValue == null) {
fixupString();
}
return stringValue;
}
public int toInt() {
if (intValue == null) {
fixupInteger();
}
return intValue.intValue();
}
private void fixupString() {
stringValue = intValue.toString();
}
private void fixupInteger() {
intValue = Integer.parseInt(stringValue);
}
}
All PHP adds are operators like + that are typed Scalar -> Scalar instead of Number -> Number, making up arbitrary behavior for non-numeric values. If you wanted dynamic typing in Java, you would just write a special math library over your Scalar type and write your application in terms of those operations instead of the built-in ones. The reason nobody does that is because the static typing, though verbose, makes for nice self-documentation.
At some point you need to decide on a type for a value and most people try to do that as soon as possible. When I write in a dynamically typed language that's not Python, I usually assert well-formedness immediately after reading the data from outside my program. At that point, dynamic typing is a loss in safety to me. (When I write Python, I never explicitly check types and let mistyped operations fail at runtime, because that's the convention.)
Anyway, that was a fun article.
- bithive123 14y agoAnd this is why you should learn your abstractions, kids!