
DHH on the immediacy of PHP (2008) - tilt
http://david.heinemeierhansson.com/posts/23-the-immediacy-of-php
======
mschuster91
The biggest advantage PHP has is that it's easy to set up: either the hoster
already has php, or it's a simple matter of apt-get install if you're
developing on your own. No messing around with config files, server ports,
..., it just Works (tm).

PHP enables really rapid development: just save the file and reload in your
browser to see a change, compared to Java/CGI-C which need recompiles.

And finally, PHP is written expressly for the web, not like Java, Python, Ruby
or whatever the latest fad is these days - where web stuff was bolted on
instead of baked in the design and operations of the language.

~~~
Udo
There is one other strength that PHP has which is not replicated by any other
runtime on the web, with the partial exception of Perl: its execution model.
PHP code is executed per-request only, as opposed to within the context of an
already-running app server. This means your PHP app has _no state beyond what
you explicitly build into it_ during each request, and this makes reasoning
about state and control flow very easy. I love how this makes debugging,
optimizing, and scaling, much more natural.

This is the reason why PHP is still my go-to first choice when it comes to
request-based server apps (and together with Node.js it's also a good option
for continuously-running applications). For me, the sore points of PHP are its
syntax, scoping behavior, and the awkwardly structured standard library - to
the point where I occasionally look elsewhere, or consider building an
alternative myself.

~~~
jskulski
This also leads to the rise of single tons and creating objects wherever you
need them. It's hard to grok Dependency Injection when your objects live and
die all the time.

It makes reasoning about state easy because you don't have to consider it. In
my experience (which involves several large and mature PHP codebases), that's
not a good thing.

You're right about the benefits, but the downsides are glaring too.

~~~
Udo
I agree, and I see every day that PHP apps are not written with both these
pitfalls and advantages in mind. Instead, most "foreign" PHP code I look at
today is either made to look like it was designed for a Java app server or is
so ineptly cobbled together that no apparent thoughts were invested into the
structure at all.

I blame both of these on the messaging and marketing coming out of Zend and
the surrounding ecosystem, namely that PHP is supposed to be a language where
big applications are constructed with convoluted EE-like class trees, and that
PHP is supposed to be a beginner's language. Both of these constitute an
outright failure to recognize where its strengths and weaknesses lie, in my
opinion, by the same people who are maintaining the language.

------
donatj
Having moved to PHP nine years ago after being unable to find .NET work I have
to say it was the right thing to do. The jobs are STILL bountiful, and I can
knock out a prototype in PHP in no time flat. There have been a couple
instances in the last few months where I built a prototype in a couple hundred
lines of PHP then take what I learned and rewrite it as a several thousand
line Go application.

I'd argue PHP truly shines on the command line, when I need a script that does
what I need and quick. OS X comes with PHP built in and this is wonderful. The
invention of phar's akin to Java Jars has made these even more portable, such
that you can include all dependencies in a single file.

~~~
hyperpape
Why does PHP shine on the command line? OS X ships with Python, Ruby and Perl,
Linux ships with Python and Perl (not sure about Ruby).

~~~
mschuster91
Because it's fast and easy.

Python is a nightmare especially when you copy and paste stuff together from
the internet because spaces and tabs are a different thing, Perl is next to
unreadable (but immensely powerful) and Ruby is exotic at best. Then there are
bash scripts, a drama in itself and only to be used when you want cross-
platform/cross-distribution compatibility.

------
DanielDent
PHP - the early version of the 12 factor app.

------
draw_down
Problem is people start using it for this reason and end up with a mess.

~~~
carlosrg
You can make a mess with any language.

~~~
draw_down
Mm hmm.

