9 ms·
Taking PHP Seriously
- chronomex 13y agoIs such a thing even possible?
- krapp 13y agoOf course not. It only runs a paltry ~80% of the web. Just ignore it. Maybe it'll go away.
- Crito 13y agoThere are many things that are popular or successful that nevertheless I cannot take seriously. Cheech and Chong for example. "Taking it seriously" implies something more than just recognizing that it exists and is prevalent. In fact, I would go so far as to say that if you are forced to work in PHP, you should never take it seriously for your own safety and sanity. Always assume it will be and act janky, so that it cannot catch you off guard.
- krapp 13y agoModern PHP with a proper framework isn't really that bad, from a development point of view. You certainly don't have to deal in spaghetti code if you don't have to. No comment on whether that's due to modern PHP frameworks splitting the difference between pretending to be Ruby or pretending to be Java, though. Of the major server-side languages it seems to be the most adapted to its purpose - churning out web resources with as little effort as possible.
- Goladus 13y agoOf course not. It only runs a paltry ~80% of the web. Just ignore it. Maybe it'll go away. One of the nicest things about Kieth's talk is that he specifically did not make the case that network effect is a reason to take PHP seriously. He mentioned it as a data point that should pique curiosity, and proceeded to discuss concrete strengths at length instead.
- exclusiv 13y agoI 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.
- krapp 13y ago>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. I think JQuery and Coffeescript, have gone a long way to mollify people's opinions about javascript in a similar way to frameworks in PHP. And compared to PHP, some of javascript's syntax (particularly arrays, objects and anonymous functions) are a lot easier to deal with than in PHP, so there's some appreciation of that in the Node community, no doubt. But yeah, it does seem as if PHP and javascript are sort of the black sheep of the web app world.
- chriswarbo 13y ago> 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)
- 13y ago
- deckiedan 13y agoWell, kind of. Apparently ~20% of the web is wordpress, ~3% use Joomla, ~2% Drupal, and many other PHP CMS's after that. So, yes, they are running PHP, but most of the PHP usage is simply running 'standard' software, and if you're not developing within those, (either core, or plugins), then it's a much smaller percent of sites which actually are custom written by programmers which actually run PHP. So, I guess my point is, that even if a lot of the web is 'running' PHP, how much future development actually will use it? And as 'hackers', people writing new, cutting edge, different websites & apps, does PHP have anything to offer really, beyond easy to set up blogging and CMS systems for non-programmer clients? As far as I understand it, PHP is used at FB only really because that's what it was originally written in. If Mark Z. had chosen Ruby, would FB now be working on ruby compilers and so on?
- krapp 13y agoPerhaps, but aren't the bulk of today's non-PHP sites running on the standard frameworks for those languages? How many 'hackers' write Android apps without spending the bulk of their time in Eclipse, working with other people's code? There aren't a lot of pgs out there deciding to reinvent every wheel on the train. I don't think you can necessarily dismiss the impact of 'blogging and CMS' systems when judging the future of a web application language. They may not be sexy, but almost everything everybody wants to do amounts to a CRUD app turning database records into html, and you can do that in any language. I wouldn't recommend PHP for general purpose scripting though. Right now I like python for that.
- code_duck 13y agoI take it seriously in the same way I have conceded to take Windows and the IRS seriously.
- PavlovsCat 13y agoWatch the talk to find out.
- Goladus 13y agoThe speaker makes the following case: 1. PHP's "programmer workflow" is unmatched. The development model is: "modify code, reload page." That's it. Simple and effective-- nearly optimal in fact for rapid development of code. 2. Program State: all PHP programs start as a web request with an empty heap and empty namespace. Cross-request state must always be saved explicitly and this tends to reduce bugs considerably at the cost of 10ms or so additional processing time for each request. 3. Concurrency model that relies on the request/server architecture rather than a specific language feature. PHP's strict enforcement of one thread per program per request forces you to use this model. The downside is that it's not applicable outside of the web server environment. Which, he argues, is fine since you want a tool optimized for the job you're trying to do. Also: 0. He reviewed a number of PHP weaknesses, accepted that they are legitimate flaws in the language, and that if you had a PHP do-over there's no good reason to make all those mistakes again. But, he'll accept these flaws to benefit from the strengths listed above. He also shared the observation that a wide variety of programmers seem capable of becoming productive in PHP rather quickly, even if they've never used it before. 4. He reviewed tool they are developing, called Hack, to add better typing capability to PHP.
- deckiedan 13y agoInterestingly, that's pretty much how I feel about writing Python web apps in Flask. The built in reloading webserver gives (1.), the flask docs are fairly explicit about global/request state, how to share it, etc, giving near as anything (2.), the concurrency is handled by whatever server you use, be it gunicorn, waitress, uwsgi, or whatever, thanks to the wsgi protocol of python, giving (3.). There's the auto-reloading build in web server, which will crash on any syntax errors in any changed code, so I don't even have to explore every possible path to find them. Some other big deals, to me in python are the fact that requests, and input/output are all extremely separated. You never get the white-page-of-death-with-no-explanation of PHP. You never get random plugins printing something, and screwing up the headers. You never get issues with forgetting to use the appropriate number of op_cache function calls to keep slightly-less-trusted code under control. Also, keeping templates, libraries, static files, and caches totally separate always seems like a good idea to me, but PHP doesn't encourage that. I know it's possible, but so many major projects (wordpress, joomla, drupal, etc) don't enforce that, making permissions in deployment a nightmare.
- nikcub 13y agoslideshare link, for those who want to avoid the InfoQ marketing signup maze: http://www.slideshare.net/zerutreck/taking-php-seriously-keith-adams http://www.slideshare.net/zerutreck/taking-php-seriously-kei...
- jimmytidey 13y agoI love that he says "if you are a person like me, who is a c++ compiler, I mean c++ person" (16.20)
- jbeja 13y agoYes, more PHP please!.
- martin_ 13y agoHack 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 13y agoI 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 13y agoThere's a more recent tweet now saying the same thing as well: https://twitter.com/keithmadams/status/422945745528819712 https://twitter.com/keithmadams/status/422945745528819712
- SCdF 13y agoAt 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 13y agoPHP 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.
- krapp 13y agoAngular can replace much of the MVC work typically done by a backend framework and template engine, by having it be done in the browser.
- SCdF 13y agoKrapp'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.
- coldtea 13y ago>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. Not really. Perhaps you've missed all the "front side templates" thing. You can for example remove all PHP templating code, and just send JSON to be converted to HTML client side. Besides, your dichotomy is invalid in general too. You can do lots of backend stuff in the front end too, if you want. E.g if you have a PHP script that converts a POST text variable into Markdown, you can opt to do it in the client, with a Javascript Mardkown lib. You can do calculations, you can use the canvas to generate images you used to do with GD, etc.
- deleted 13y ago[deleted]
- girvo 13y agoGod-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 13y agoHave/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.
- girvo 13y agoNode.js is pretty fantastic, and yeah using TypeScript on it is a cool idea too. But, it still lacks PHP's unique architecture, in terms of execution style and focus. That, and I got bored and wanted to make a JIT interpreter. :)
- coolsunglasses 13y agoTypescript has a pretty broken type system. Subtyping done wrong (and usually is). Get more mileage out of Haskell.
- tracker1 13y agoI 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.
- tveita 13y agoI think it's mostly in HHVM, which is publicly available. It's not documented, but you can see it in the tests. E.g., https://github.com/facebook/hhvm/blob/master/hphp/test/quick/hh_type_var.php https://github.com/facebook/hhvm/blob/master/hphp/test/quick...
- flebron 13y agoI 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 13y agoBeing "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.
- debaserab2 13y agoI couldn't agree more. The PHP internals group struggles still occur to this day as new ideas and fresh thinking run up against the old guard and more often than not are discarded. I don't necessarily blame the "old guard" - they've been around a long time and they've seen a lot of failed ideas - and it's been them who dealt with the cleanup and had to maintain those broken features long past the founders of those features had moved on. This isn't a bad thing: PHP is rooted in many businesses both small and enterprise: it will be around for a long time. Projects like HHVM are going to ensure that. However, I no longer think that PHP is going to "turn it around" and will ever be a model of innovation. It lost it's opportunity to do that.
- mitchtbaum 13y agoWhoah! 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
- camus2 13y agoInteresting 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 13y ago>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 13y ago> 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 13y ago>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.
- anuraj 13y agoI 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 13y agoDo 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 13y agoAs 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 13y agoI 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.
- alien3d 13y agoi'm waiting for other language as flexible as php.. write code without thinking error message.
- MichaelGG 13y agoVisual Basic has On Error Resume Next. This is generally considered a bad thing.
- joeblau 13y agoPHP 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 13y agoThe 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 13y agoAh 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.
- jhh 13y agoI 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 13y agoGenerally 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.
- pknerd 13y agoA post I just made about what PHP has become now. https://plus.google.com/118197810020432218051/posts/17fNVWVju8D https://plus.google.com/118197810020432218051/posts/17fNVWVj...
- astrodust 13y agoThat's a pretty weak post. You really should add some clarification and examples.
- sefk 13y agoNice talk Keith. Honest, clear, and informative. Thanks.
- dogweather 13y agoDoes it attempt to refute John Siracusa's _dissertation_ on 5by5? That's the first hurdle for any pro-php article.
- iends 13y agoI 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&commit=Go http://5by5.tv/search/results?utf8=%E2%9C%93&q=dissertation&... I could not find what you meant, could you provide a link?
- nicwolff 13y agohttp://5by5.tv/hypercritical/17 http://5by5.tv/hypercritical/17
- apanonymous 13y agoI 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.
- sudy 13y agoI am a PHP developer and I like it
- dkhenry 13y agoThis 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 13y agoThis 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.
- puppetmaster3 13y agoIf 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!