Live data from Hacker News

The Lesser Known Contributors Who Are Trying To Make PHP Good Again

danielnill.com

21–30 of 53 posts

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#21
post #10

While I've bashed PHP as much next guy, these are the facts: -Take away PHP and the internet would break. The vast majority of websites are either written in PHP or have a PHP back end. -The LAMP/LNMP stack is by far one of the most deployed web server configuration. -PHP is extremely well documented and it's been around so long that it's easy to find solutions on the web. PHP is the Model T of web languages: people…

I don't know enough to deeply critique the various web languages, but if PHP is the Model T, wouldn't it sound odd and backwards facing to talk about reviving and improving it?

The analogy breaks down quickly, because cars are mostly standalone, and can be replaced with little risk, while software is often complex and interconnected, so the benefit of a rewrite in a new language only rarely exceed the massive risks of abandoning your clunky but well-tested codebase.

But, sticking with it, it's comes down to there being a huge market in parts and service. Something like all taxis in the US still being Ford Ts, with very little forecast of change.

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#22
Those examples aren't good differentiators between PHPUnit and Phake. And unfortunately, despite how goot Composer it, it just adds another package management system into the mix. GitHub has ended up being the best package manager PHP could really ask for.

I kind of view the native PHP development server as getting featural parity with Rails and Django. But it seems like that's a major gripe for developers who are averse to working with Apache or Nginx for being too complex.

I'm very excited for traits as a feature. This is when we get into real language features other, more prestigious or "hot" web development languages actually have that PHP lacks. These result in true architectural deficiencies requiring annoying hacks to accommodate.

In the end, PHP itself benefits most from expanding its capacities as a logical formalism. Tools are great, but they're also a lot less easier to get right.

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#23
post #9

Everyone probably knows this, but PHP's Smarty template engine ( http://www.smarty.net ) is really awesome. I've yet to see a better one in any language - it has things like Unix-like pipe chaining of filters, user defined functions, and intelligent caching built in. I reduced the number of lines in one codebase I worked on by 70% through use of Smarty.

Those features are a persuasive argument against smarty as a template language.

One of the worst flaws of php is that it makes it easy to mix up code and the view, which is ok if you're writing a single page, and terribly dangerous if you're writing anything more complex.

I've experienced this myself writing templates for things like phpbb (thankfully not something I do frequently) - every time the forum updates, the templates have to be patched again - they even have a weird patching system to try to work around the issue with code in views.

A better template language would actually limit the amount you can do in your view files to the bare minimum - something like mustache comes to mind. If you want to keep the views maintainable, easy to swap out, and easy to add alternatives to like json or XML as well as HTML, the aim should be to reduce the lines in your codebase by putting the filters, caching and logic around your views in helpers rather than inside your views.

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#24

Time to beat this dead horse again! PHP as a language isn't great, since it has been around the block in a volatile environment (the web) and shows lack of foresight in language design. However, PHP is experiencing a renascence with modular components, frameworks and tools utilizing established design patterns, and an overall boost in contribution and collaboration in the open-source community, in large part thanks t…

A lot of good people are working on a lot of PHP that isn't going away, and obviously they are going to improve tooling and the language itself. There is a renaissance in terms of making PHP development sane and thus not something good people run away screaming from - a bit like Java.

But the benefits of starting a new project in PHP are few: All of the original benefits (mainly low barrier to entry) are eradicated, and that leaves PHP to compete directly, as a full development environment, not as the only easy way to get code on the web, with a myriad of other languages that can, almost objectively, be thought of as better. Again, a bit like Java.

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#25
post #8

You shouldn't forget about PSR-0 / http://www.php-fig.org/

PSR-0 would be great, except for the use of mixed case filenames. The number of packages that have obviously only been tested on HFS+/other case-insensitive filesystems is staggering (or maybe I just have bad luck picking ones). The only logical reason I can see they didn't normalize and lowercase filenames is that the big boys had too much legacy cruft already broken.

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#26
post #19
post #9

Everyone probably knows this, but PHP's Smarty template engine ( http://www.smarty.net ) is really awesome. I've yet to see a better one in any language - it has things like Unix-like pipe chaining of filters, user defined functions, and intelligent caching built in. I reduced the number of lines in one codebase I worked on by 70% through use of Smarty.

PHP is itself a template engine. Bolting a template engine on top of that makes no sense whatsoever.

I hate PHP and don't even want to talk about it but I did skim through the docs for Smarty. The rationale is that PHP sucks as a template engine, so why not create a new one and use PHP for the model-controller/whatever.

Maybe that seems perverse, but you have stuff like Node.js in existence that oddly enough solves some problems quite nicely, so maybe it works for PHP guys. I'll never see the appeal compared to other languages though.

edit: That being said, the final result looks kind of horrible to me.

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#27
post #10

While I've bashed PHP as much next guy, these are the facts: -Take away PHP and the internet would break. The vast majority of websites are either written in PHP or have a PHP back end. -The LAMP/LNMP stack is by far one of the most deployed web server configuration. -PHP is extremely well documented and it's been around so long that it's easy to find solutions on the web. PHP is the Model T of web languages: people…

PHP is extremely well documented and it's been around so long that it's easy to find solutions on the web.

I can agree that PHP is documented. That it is well documented however is something I'm very much willing to argue against.

PHP has string-operations documented to be "binary-safe" without ever saying what that is supposed to mean, if it's good (it's not), if it's bad (yes, yes, yes it is) and why you should have an opinion on that at all. Nothing about that. "Binary-safe" is not defined anywhere. It just "notes" that all these operations which should operate on text is "binary-safe". And "safe" makes it sound like a good feature, right?

Documentation like this is probably written by people who have no idea what a character encoding is and thinks that being able to strpos() on raw byte-data is a "cool feature", without understanding that text and it's encoded representation are two very different things.

Basically, the documentation is written by people lacking any deep understanding of the subject they are covering, and they pass their confusion on to whoever may be unfortunate enough to stumble upon it.

So... Is bad documentation better than no documentation? I don't know. Maybe? Still: PHP documentation, good or bad, represents the blind leading the blind.

If you want "extremely well documented", head over to MSDN and check the .net docs. It's systematic, it's consistent and it's thorough. It's written by people who understand the difference between Unicode, UTF8, text and bytes. Or whatever else the subject you are reading about covers.

But people peddling in PHP wouldn't know that, because they wouldn't want to go too far outside their comfort-zones, and hey, they definitely wouldn't want to look at anything done by Microsoft.

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#28
post #19
post #9

Everyone probably knows this, but PHP's Smarty template engine ( http://www.smarty.net ) is really awesome. I've yet to see a better one in any language - it has things like Unix-like pipe chaining of filters, user defined functions, and intelligent caching built in. I reduced the number of lines in one codebase I worked on by 70% through use of Smarty.

PHP is itself a template engine. Bolting a template engine on top of that makes no sense whatsoever.

Seriously? PHP "was" a template engine. But that was before 1998 when no one knew what was a good idea or a bad idea when it came to building web apps.

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#30
post #19

Earlier quoted context omitted.

PHP is itself a template engine. Bolting a template engine on top of that makes no sense whatsoever.

I hate PHP and don't even want to talk about it but I did skim through the docs for Smarty. The rationale is that PHP sucks as a template engine, so why not create a new one and use PHP for the model-controller/whatever. Maybe that seems perverse, but you have stuff like Node.js in existence that oddly enough solves some problems quite nicely, so maybe it works for PHP guys. I'll never see the appeal compared to othe…

Completely unrelated: I'm not easily offended. Right now I'm not offended at all, in case anyone would interpet this post to mean so. I'm all OK. Really.

But that said: I'm severely puzzled about your choice of HN username.

Post reply on HN