

PHP Is A Husk - lucasoman
http://lucasoman.blogspot.com/2009/08/php-is-dead.html

======
thaumaturgy
I usually don't jump into these kinds of threads. You get an awful lot of
programmers -- some hobbyist, some professional, some experienced, and most of
them self-taught -- all with their own prejudices and methodologies, all
arguing over what the "right" way is. They go absolutely nowhere, do nothing
productive, and turn into a huge time sink for everyone involved.

That said, this article, and every other one like it, reeks of some strange
belief that every single language is supposed to have all of the features of
some programmer's favorite language, as well as all of the neat new trendy
stuff, and if the language doesn't support all of that -- well then it's dead!
Or dying. Or "a husk".

There doesn't seem to be any realization on the part of the programmer that a
particular language is just a tool, usually designed for a specific
application. The programmer is attempting to fit a square peg into a round
hole, and they're cursing at the square peg because it doesn't fit.

Let's take one example: closures. They sounded interesting, and potentially
could solve a problem in a large JavaScript library I was working on. So I got
to know them, I practiced with them, I made sure I grokked them before trying
to apply them. Then I put them to work, and found that they ended up making my
library unnecessarily complex, that they caused some odd behaviors
occasionally, and that they didn't solve any problem that I couldn't more
easily solve using simpler methods.

So, does PHP's lack of this author's favorite features really make it a
"husk"? No, not at all. Applications as large and complex as osCommerce don't
rely on those language features; they rely on the features that the language
does have, and they work just fine.

One of the most basic skills programmers need to have in their toolbox is the
ability to adapt their habits according to the tools they're using. The
programmers that spend their time writing blog posts like this one don't seem
to have picked that up.

...Ugh, this just cost me 10 minutes that I could've spent actually working on
one of my projects. :-(

~~~
lucasoman
I'm not complaining about what features PHP has. In fact, I was never that
annoyed that PHP didn't have lamdas or closures until now.

My problem is that it wasn't implemented _correctly_. If you're going to
implement a feature, do it right or don't do it at all. Their lack of concern
or pride in their project does not bode well for the community.

~~~
Legion
This is a reasonable statement.

But there's a bit of a delta between this and the attention-grabbing title of
the post.

~~~
lucasoman
Sorry; it wasn't meant to be attention grabbing. It was more out of
frustration, I suppose.

------
jacquesm
It's a crappy title, but the article is pretty good.

PHP is a niche language, the niche is probably best described as "for want of
something else that seems so easy to use and has such a low barrier to entry
we are forced use it for web development".

The interesting thing here is that apparently the difference between PHP and
the 'rest' of the languages out there is not large enough to supplant PHP in
the WWW domain.

It's close enough to C that a whole generation of C programmers is intuitively
at home in PHP, until they start using its advanced features.

But as long as you have to do simple stuff and get paid for that it almost
always works. The few times that it doesn't you wished you never knew about
the language though.

Just imagine, a language where the default 'scope' is global but globals are
not available to functions and silently get replaced with empty variables. Who
came up with that gem ?

~~~
jamroom
The default scope within a function is not global, and all global variables
are available within a function by using the keyword "global". You can also
access the superglobals, but that of course is optional.

~~~
jacquesm
hacking the procrast to be able to answer you...

The default scope is global, I did not say 'within a function'.

I know about the 'global' keyword, as does everybody else that has used PHP
for more than 5 minutes.

If your language has a C like syntax and you have a default scope (which means
that you can start executing code right from the first line without being in a
function definition) then the default behaviour of a variable should be that
it either does not exist inside a function (different scope) and throws an
error or it should refer to the global variable.

To have a 'third option', which silently creates empty variables is very (no,
make that extremely) poor design.

And no, I'm not telling how to break noprocrast :)

------
dpcan
If you are trying to do something "more advanced", why are you trying to use
PHP at all? What do you consider "advanced"? Just the WAY you use the
language, or the application you are trying to write?

PHP is trying really hard (it seems) to be a more advanced language, possibly
to get new users to move over from other languages.

But they don't need to.

They should just stick to their roots, do what they do best:

Super small learning curve, low barrier to entry, it's everywhere, it works
great for most apps, keep CRUD super-simple.

~~~
jamroom
So far I have not personally run into anything I _can't_ do in PHP - it may
take some creative thinking, but there is usually a solution - this includes
"advanced" functionality as well.

I think what a lot of the issues people have with PHP is not that it can't do
something, but more that many of the ways you implement something feels like a
"hack" - it works, but isn't as elegant as other languages.

------
garnet7
My guess is that many developers probably don't actually _choose_ PHP per se
but rather get _stuck_ using it because that's what the shop they work for
uses, or that's what the current site is implemented in and they're only
adding a feature, or that's what the client is asking for, etc.

More interesting to me is the question: Why is PHP beating Python in this
space? Some guesses:

* PHP webapps far easier to deploy.

* PHP docs give more usage examples, and also allow user comments.

------
pyman
Very mediocre post. Including the comments.

"Use php, python, no, use ruby instead! Facebook uses PHP, YouTube Python,
blah blah".

Kids, kids, behave! Scripting languages are for kids and web developers who
don't know anything about programming and software engineering.

I've worked with Perl and Python developers for the last couple of years...
they struggle to understand design patterns and don't even know what a domain
object is.

------
shaunxcode
I don't think the lambda and closure support was intended to mesh so
succinctly object oriented features of php. You have to realize php is a
multi-paradigm language and proceed accordingly. You can honestly implement
your own oo system using arrays and anon functions/closures if you would like
(much like perl). The only thing making it a little fugly/brutal is the
HORRIBLE php "array(" syntax.

------
pyman
Very mediocre post. Including the comments. I think scripting languages are
for kids and web developers who don't know anything about programming and
software engineering.

I've worked with Perl and Python developers for the last couple of years...
they struggle to understand design patterns and don't even know what a domain
object is.

------
pyman
Very mediocre post. Including the comments. I think scripting languages are
for kids and web developers who don't know anything about programming and
software engineering.

I've worked with Perl and Python developers for the last couple of years, they
struggle to understand design patterns and don't even know what a domain
object is.

------
pyman
I think scripting languages are for kids and web developers who don't know
anything about programming and software engineering.

I've worked with Perl and Python developers for the last couple of years...
they struggle to understand design patterns and don't even know what a domain
object is.

------
mjs
The corresponding PHP bug report:

<http://bugs.php.net/bug.php?id=47665>

(Closed as "not a bug". Surprise!)

------
ojbyrne
I found the repeated misspelling of "lambda" to be off-putting.

~~~
lucasoman
Fixed, thanks for pointing that out. And as "the guy who built Digg.com for
$10/hr", that's all the feedback you'll give me?!

~~~
ojbyrne
I use php everyday, and as the guy who built digg (in php) I'd say - I agree
with everything you say, but 99% of business has nothing at all to do with
what programming language you use. But, _intellectualism_ does have plenty to
do with building a successful business, and for most developers, that
manifests itself as language wars. So I liked the article from that
perspective.

~~~
lucasoman
Yes, I understand the business side. But I studied Computer Science in school.
I take pride in my work, and I regard an expertly-forged piece of code as a
work of art. It's not simply a means to an end, and, even if sometimes I
complain a lot, I hope even my employer sees the benefit in my taking what I
do so seriously.

~~~
pyman
Haha, you are not Van Gough, you are a code monkey. You think your code is a
piece of art, but the guy who's going to maintain it may think it's a piece of
shit and can end up rewriting it, using a different language, one he thinks is
better. Just like you did, Mr. van Gough ;)

------
onreact-com
It is? Strange, mine still works. Am I a PHP zombie?

On a side note: I'm tired of the "Pull a Calacanis" type of headlines like "x
is dead", "x sucks" or "x is bullshit".

Please come up with something better.

~~~
mechanical_fish
It's too bad that standard hacker slang for "I am incredibly disappointed and
feel like kicking something today" is so similar to linkbait. But, really,
what is one supposed to say when one discovers this:

 _$this cannot be used in lambdas or closures. So, when it comes to using
these new features with objects, they're quite nearly completely useless._

... except "This is bullshit?" I mean, that's the _censored_ version of what I
think about this.

~~~
lucasoman
Exactly! I'm not interested in link bait. I'm just really depressed after I
finally made the realization--just last night--that the language I've been
using for years is going nowhere but down.

~~~
pyman
It looks to me that the only thing going down is you, as a programmer. You've
been writing PHP scripts all your life, I understand why you are depressed.

~~~
lucasoman
_yawn_

