
Taking PHP Seriously - kmavm
http://www.infoq.com/presentations/php-history?utm_source=infoq&utm_medium=QCon_EarlyAccessVideos&utm_campaign=StrangeLoop2013
======
flebron
I really liked this talk.

PHP was my first language when I was starting out professionally, and before I
went into university and learned "proper programming". Back in 2007-2008, I
remember the mess it was, with the internals list being a permanent struggle
to implement anything by consensus (no lambdas or JS array notation because it
wasn't easy to google, for example), and it really did look like a dead end.
The internal source code of PHP was often a mess of macros everywhere, and the
whole PHP6 unicode fiasco really did paint a grim picture of its future.

Facebook seems to have given it a bit of fresh air, implementing some pretty
interesting stuff (Hindley-Milner with subclasses, for instance), and it
really seems like the "feel" of programming in PHP has changed. I'm not going
to say "Screw C++ and Haskell, _this_ is a serious language!", but on the
other hand I feel I can say with a straight face to someone who is starting
programming, "You could check this language out", without a guilty conscience
that I'll be ruining their mind.

I'm unsure of PHP's future - if it'll be tied to Facebook (and thus Facebook's
future, which I am equally unsure of), for example - but as of now, it seems
to be a reasonable, if idiosyncratic, language.

So yeah, good talk :)

~~~
camus2
Being "tied" to Facebook is the best thing that can happen to PHP. I stopped
taking PHP core devs seriously since the PHP6 fiasco. PHP is doomed with these
guys, trust me, no matter how much effort is put into Doctrine, Laravele
,Symfony or other libs.

At some point , every big open source project team must make tough choices to
make the project "future proof". Python team did it, Ruby is doing it,NodeJS
will to be compliant with ES6 modules.

They did not.

~~~
coldtea
> _Being "tied" to Facebook is the best thing that can happen to PHP. I
> stopped taking PHP core devs seriously since the PHP6 fiasco._

The "PHP6 fiasco"? A major featured release was too much, and had to be scoped
down. Since then most stuff has been released as 5.4, 5.5 etc.

Did it break anybody's code? No. Did it divided the community? No. Did it
halted PHP development? No. At worst, it make some prematurely released PHP6
books obsolete. Big fucking deal.

Compared to Perl 6 (still MIA for actual production development) and Python 3
(only 10% adoption or less after 5 years for an update that doesn't even offer
that much), I'll take the PHP6 fiasco anytime.

> _At some point , every big open source project team must make tough choices
> to make the project "future proof". Python team did it, Ruby is doing
> it,NodeJS will to be compliant with ES6 modules._

Python 6 did it badly, Ruby didn't do much, and NodeJS will have the ES6
modules "update" happen automatically by virtue of them being based on V8.

~~~
codygman
I thought the perl 6 implementation was actually complete.

~~~
chromatic
It isn't.

~~~
dogweather
Ouch. Sorry to hear it. But good to hear you weigh in.

------
SCdF
At my job I maintain some PHP that we are slowly removing (and replacing with
Scala for the backend and Angular for the frontend). My total experience with
PHP prior was writing a tiny wordpress plugin a decade ago that added some
anti-spam stuff to comments.

And you know, PHP, it's not so bad. It gets the job done, it deploys instantly
(the rest of our code is mostly Scala. Oh. My. God. Just. Build. Already…). It
can be pretty haphazard, you can do some funky stuff with it (the abilty to
pass by reference on integers and other 'primitives' caught me by surprise)
and I wouldn't pick it for new code, but it's certainly not the steaming heap
of evil that people make it out to be.

Maybe our code is just awesome, idk.

~~~
jafaku
PHP is a server-side language as you might now, so you are not replacing
anything of it with Angular for the frontend, that's just an addition.

~~~
SCdF
Krapp's right, but to clarify: PHP that generates HTML that uses jQuery is
getting replaced with Angular that talks to the server via a REST interface
written in Scala / Spray.

------
camus2
Interesting talk , curious about Hack.

PHP is a horrible language with great libraries and a few good features. A lot
of successfull projects are written in PHP. The execution model is good enough
for some types of apps(blogs,e-shops,...).

As a PHP developer , i'm betting on Python and NodeJS for the future, i dont
believe PHP has any real future outside a bunch of popular CMSes. While PHP
has excellent libraries (Symfony,Doctrine,...) , Python has very good ones
too, and it IS trully multipurpose.

When i first came to Python i did not like its OOP model(no
interfaces,...),but Python metaprogramming features are unique and very
interesting to learn.

The biggest problem with PHP is its core developers, adding some "feature" is
not fixing the language. Removing the bad parts should be the focus of the
next PHP versions. It is not.

~~~
ciclista
>As a PHP developer , i'm betting on Python and NodeJS for the future, i dont
believe PHP has any real future outside a bunch of popular CMSe

Same here, having done very large php projects in the past, nowadays I tend to
go for python (or more recently node) unless the client requests it.

One thing I foresee being a good niche in the future is updating/fixing legacy
php apps. There's just too many man hours into them. It will be the COBOL of
the web centric future.

~~~
porker
> One thing I foresee being a good niche in the future is updating/fixing
> legacy php apps. There's just too many man hours into them. It will be the
> COBOL of the web centric future.

I've been doing that for the last 3 years. I think it's mostly driven by the
recession - firms don't want to rewrite/rebuild their software (rightfully,
they don't understand why it can't run for longer than 2-3 years without
breaking).

However, updating and fixing symfony 1.0 apps is the most soul-destroying work
I have ever done...

~~~
ciclista
>I think it's mostly driven by the recession

That and there's still a "it's easy to find php developers" amongst business
people IME. Not that I mind php, I've used it long enough to work around it's
issues.

------
nikcub
slideshare link, for those who want to avoid the InfoQ marketing signup maze:

[http://www.slideshare.net/zerutreck/taking-php-seriously-
kei...](http://www.slideshare.net/zerutreck/taking-php-seriously-keith-adams)

~~~
nikcub
I just realized that the MP3 is also behind a login wall, here is a mirror:

[http://files.nikcub.com/mirror/takingphpseriously.mp3](http://files.nikcub.com/mirror/takingphpseriously.mp3)

37.8MB

------
anuraj
I came to PHP after long stint with C, C++, Objective C, Java and Javascript -
and I was productive from day 1. I have programmed extensively, and have come
across few quirks, but never got stuck, nor is my code spaghetti. I do not use
frameworks where they can be avoided and write extremely simple code and avoid
OOP for scripting. I would not do OOP with a language without strong typing.
My take is for short lived HTTP requests which need to spew out some JSON
preferably(favor headless coding for frontend), PHP is the apt tool. For heavy
lifting, use a strongly typed language which can easily handle complexity.

~~~
debaserab2
Do you have an example of a non-trivial project that was written in PHP that
is not spaghetti code that doesn't use OOP as it's foundation for
organization?

I want to believe that it's possible. When you start introducing even the most
basic complexities of a web app (authentication, access control, database
connections, reusable CRUD functionality - all the things that make up a non-
trivial application) I find it really hard to stay organized in a procedural
style.

I'm not being snarky; I'd love to see a good example of this.

~~~
rmrfrmrf
As a PHP zealot, I'm _also_ really interested in this. I drink the OOP Kool-
Aid 100% when I code in PHP since it forces at least some level of structure,
but I'd love to see a successful procedural approach.

~~~
aethr
I believe that Drupal 7 qualifies as a non-trivial PHP application that only
uses OO in a minimal number of applications in core (ie, when it's
appropriate).

Some would definitely argue that Drupal results in spaghetti code, due to a
large amount of module functionality being written in hooks that are invoked
to change behavior at runtime. It also has an elaborate theming process that
yields many opportunities for module or theme code to modify data as it passes
through the layers of data generation, processing, theming, etc.

My personal experience on some large Drupal projects is that with an
experienced team that knows "the Drupal way" of doing things, you can write
some very well organised code that is easy to maintain and extend. However, I
doubt this is the norm with Drupal projects.

I also think that Drupal 8 and beyond will move more and more towards an OO-
based methodology, as the learning curve for the current system is very high.

------
girvo
God-damn.

I just spent the last week working on a new language that... turns out, is
basically Facebook's new language: Hack. Although, it does seem they've not
released it to the public, so I suppose I'll keep working on it, heh.

My new language steals PHP's "shared-nothing", "bootstrap from nothing at
request" but steals Typescript (and Hack's, apparently) gradual typing system,
along with a saner, less ridiculous StdLib.

~~~
tracker1
Have/had you considered using typescript or coffeescript on node.js? Just
curious here.. I know there's other options and platforms, just really do like
node+npm a lot.

~~~
coolsunglasses
Typescript has a pretty broken type system. Subtyping done wrong (and usually
is).

Get more mileage out of Haskell.

~~~
tracker1
I actually like JS myself.. it's been pretty much my favorite language for a
long time (long before the good parts book)... Used it with Netscape's web
server, and even in classic asp. There are still a lot of advantages to a
single language across your stack. It's also a natural fit with document
databases... and even Pg with v8 support. It's not the "best" of all worlds
language, but it's definitely the best in terms of coverage.

------
jimmytidey
I love that he says "if you are a person like me, who is a c++ compiler, I
mean c++ person" (16.20)

~~~
elwell
Facebook hires c++ compilers, good to know...

------
joeblau
PHP is a strong language for the web, but the community is not. I really only
see Facebook pushing the language and even though Steve Ballmer has been memed
to death about his "Developers" rant, the developer community is really what
makes languages like Ruby/Rails and Node.JS more attractive.

I definitely applaud all of the work the Facebook team has done in order to
push the limits of PHP and turn it into something that developers are actually
comfortable working with. With that being said, I still don't think it's
better than I thought it was.

~~~
bilalq
The PHP community is doing quite well these days. The advent of things like
Composer, FIG, and PSRs have brought a breath of fresh air into the PHP
landscape. There's a bit of a renaissance going on here.

~~~
joeblau
Ah I see. Yeah I haven't kept up with the PHP community really for about 5
years. I'll definitely have to take a look some time in the next coming weeks
to see what's been going on.

------
dkhenry
This is not about taking PHP seriously. This is about taking Facebooks
internal development language _based_ on PHP seriously. By the time you factor
in a different run time and the various language extensions they have made you
no longer have PHP. In fact everything they have done has been to turn their
existing PHP codebase into a better language and to their credit they have
added some excellent tools to make that migration smooth. The question is at
what point are you no longer writing PHP but writing facebook PHP with a VM
that still lacks documentation and in the name of backwards compatibility
carried forward the warts of the old PHP.

~~~
bonemachine
_This is not about taking PHP seriously._

The point as I understood was that for all of PHP's faults, (almost by
accident) it managed to get certain things right, or at least right for the
Web in the time in the time of it's heyday.

These being, chiefly, that the much-maligned document-based scripting model
turns out to be _really_ easy to package, deploy, and most of all, to _learn_.
And that it also (again by accident) happens to be in some ways easier to
program safely in, compared to handler-response based frameworks.

Don't get me wrong -- I don't see these as anywhere close to redeeming
strengths for PHP. It's still a crappy language, all the cheerleading and
apologetics from the likes of FB and Etsy notwithstanding. But the
presentation does make some interesting points.

------
martin_
Hack sounds pretty awesome, it's strange I haven't seen mention of that
alongside hip hop before - also he mentioned "hacklang.org" but that seems
completely different

~~~
itafroma
I tried looking for something by way of an official announcement or release
(preview or otherwise), but as Keith Adams joked, it's impossible it Google
it, and the [http://hacklang.org](http://hacklang.org) URL he referenced is
not correct.

Someone in the Q&A pointed that out, so he mentioned that there'd be a post
about it on the HHVM blog, but there doesn't seem to be anything about it in
the last few months (this talk took place in September). Someone asked Keith
Adams on Twitter at the end of October, where Adams said there was nothing to
announce yet:
[https://twitter.com/keithmadams/status/395658859722723328](https://twitter.com/keithmadams/status/395658859722723328)

The only other thing I could find about it was another talk by Julien
Verlaguet (to whom Adams credits the invention of Hack) from October:
[https://www.youtube.com/watch?v=gKWNjFagR9k](https://www.youtube.com/watch?v=gKWNjFagR9k)

~~~
datr
There's a more recent tweet now saying the same thing as well:
[https://twitter.com/keithmadams/status/422945745528819712](https://twitter.com/keithmadams/status/422945745528819712)

------
mitchtbaum
Whoah! Thank you for linking to this video series. Another video from this
Strange Loop 2013[0] conference is on Symmetry in Programming Language
Design[1]. I am finding it to be way more up my alley.

[0]: [http://www.infoq.com/strange-loop-2013/](http://www.infoq.com/strange-
loop-2013/)

[1]:
[http://www.infoq.com/presentations/noether](http://www.infoq.com/presentations/noether)

Edit: Posted to
[https://news.ycombinator.com/item?id=7054815](https://news.ycombinator.com/item?id=7054815)

------
jhh
I think this was a worthwhile talk. The speaker makes some interesting points
about the importance of "ergonomic properties" of languages.

He convincingly explains why PHP was so succesful: Workflow (just hot reload),
Concurrency (in the sense of "shared nothing" HTTP requests), and State (every
request starts from a "clean plate", which reduces long-time statefulness bugs
if you know what I mean).

An interesting point he raises is that PHP leaks it's GC mechanism to the API,
which makes implementing a fast VM harder for the HHVM team.

------
dscrd
Generally a good talk and a good defense, but I didn't quite appreciate his
new definitions of "State" and "Concurrency".

And did he really compare a full operating system to Facebook's web apps in
terms of complexity? If that's true, there has to be a _lot_ of accidental
complexity in FB.

------
apanonymous
I haven't currently moved on to learning PHP yet, I've been using Python quite
regularly for the past few years and a lot of Java Script. PHP could possibly
be the next language for me to learn.

------
dogweather
Does it attempt to refute John Siracusa's _dissertation_ on 5by5? That's the
first hurdle for any pro-php article.

~~~
iends
I tried to find what you are talking about by goolging, and by searching
directly at
[http://5by5.tv/search/results?utf8=%E2%9C%93&q=dissertation&...](http://5by5.tv/search/results?utf8=%E2%9C%93&q=dissertation&commit=Go)

I could not find what you meant, could you provide a link?

~~~
nicwolff
[http://5by5.tv/hypercritical/17](http://5by5.tv/hypercritical/17)

------
pknerd
A post I just made about what PHP has become now.

[https://plus.google.com/118197810020432218051/posts/17fNVWVj...](https://plus.google.com/118197810020432218051/posts/17fNVWVju8D)

~~~
astrodust
That's a pretty weak post. You really should add some clarification and
examples.

------
sefk
Nice talk Keith. Honest, clear, and informative. Thanks.

------
puppetmaster3
If you use PHP, you can't CDN your HTML. If you use PHP, you can't PhoneGap
build your HTML.

I recommend pure HTML (and call API/CORS). (Same is true of ASP, etc.). Pure
HTML!

------
alien3d
i'm waiting for other language as flexible as php.. write code without
thinking error message.

~~~
MichaelGG
Visual Basic has On Error Resume Next. This is generally considered a bad
thing.

------
chronomex
Is such a thing even possible?

~~~
krapp
Of course not. It only runs a paltry ~80% of the web. Just ignore it. Maybe
it'll go away.

~~~
exclusiv
I also find it funny that people who hate on PHP used to hate on JavaScript
for many of the same reasons and they now have an unhealthy, public love
affair with it. That and people who tried jamming WordPress or some CMS into
every use-case 10 years ago are commenting on how they don't like PHP. IMO,
PHP has kept it's charm but added a lot of good stuff from other languages
like Java. PHP is the language of choice and getting shit done. Oh, and not
having to worry about lack of work.

~~~
chriswarbo
> I also find it funny that people who hate on PHP used to hate on JavaScript
> for many of the same reasons and they now have an unhealthy, public love
> affair with it.

Javascript used to be clunky due to cross-browser issues. These are mostly
resolved now (at the language level).

PHP, on the other hand, has always been clunky. For example, it's often said
that parsing is a solved problem. Try telling that to PHP:

$x = function() { return function() { echo "Hello"; }; }; $x()(); // Syntax
error??!

$y = new stdClass; $y->foo = function() { echo "World"; }; $y->foo(); // "No
such method 'foo'"??!

I've written quite a few parsers, but still have no idea how PHP's could end
up like this. Here are some recent 'features' from PHP 5.4 and 5.5 which every
other parser on the planet would have handled from day 1: \- Passing an
arbitrary expression instead of a variable to empty() is now supported. (PHP
5.5) \- Function array dereferencing has been added, e.g. foo()[0]. (PHP 5.4)
\- Class member access on instantiation has been added, e.g. (new Foo)->bar().
(PHP 5.4)

~~~
marcosdumay
> I've written quite a few parsers, but still have no idea how PHP's could end
> up like this.

Have you ever tried to parse code with a set of context sensitive rules (like,
not using yacc, but writting your parser case by case at hand) and context
free regular expression (don't use look ahead at all, and you also can't look
behind)? PHP errors look a lot like this.

------
jbeja
Yes, more PHP please!.

------
sudy
I am a PHP developer and I like it

