Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Here is another point that highlights the problem:

If I want to write a hello world application in PHP, it's neither as long as <?php print("hello world");?> nor as short as <?="hello world"?>

Rather it's simply: hello world. Just type in those 11 characters in a text file and save it as hello.php. Now load it on your browser [or run it from command line] and it will print hello world. I don't think it can get any more simpler than that in other languages. PHP was developed from the ground up as a templateting language for serving HTML pages. These other languages are more of a general type.

Therefore the replacement for PHP should come through a new language targeted as a replacement for PHP as Jeff said. Otherwise there always be extra web/template stacks for the developers to take care of. And that will be the first hurdle to learn and overcome for novice developers looking for switching to something easier.



I'm not convinced this is true. You see, way back in the day in 1997 when I was doing web dev, everything worked the way PHP does. ColdFusion, ASP (not ASP.net, ASP), PHP, and almost everything else that was seriously trying to do web pages worked that way. It took the community collectively a long time to stop seeing URLs as identifying anything but specific files. This is back when having those files be programs was still a bit of an innovation.

After 15 years of one of the biggest bursts of innovation the open source world has ever seen, and with such diversity in frameworks that the mind boggles, nobody has returned to this model successfully. I've got MVC-inspired designs coming out my ears, continuation-based designs, frameworks just beginning to incorporate web sockets deeply (instead of as an afterthought), GWT, ASP.net, and other attempts at building a fundamentally different model and compiling it into another, and everything under the sun... but no return to the page-is-program model.

I don't think it's the key to PHP's success, because even in the competitive-yet-very-fertile soil of the web framework world, nobody else can make it work anymore. I think it's vestigial, and nothing else.

(Personally I think the key is simply that everybody has deployed it, and since there's basically no way to force every web hosting company to support Language X simultaneously, PHP isn't going away until the entire concept of web hosting goes away. Which isn't anytime soon.)


The page-is-program model still works as well as ever. It's just that, if your problem is so simple that the page-is-program pattern is most appropriate -- for example, if you are eight years old and you want to build a page that serves up a different picture of a dinosaur every time it gets reloaded -- you should just use PHP. Why choose anything else?

It's true that other languages have not wasted a lot of time trying to displace PHP as the language of choice for anonymous random dinosaur servers. That's because there's no money in fighting PHP on its home turf. The turf just isn't worth enough.

"Vestigial" is the wrong word. That's like describing a screwdriver as "vestigial" because the impact driver has been invented. Sure, impact drivers can accomplish many things that mere screwdrivers cannot, but that doesn't mean that screwdrivers aren't still useful, and numerous, and popular.


Vestigial is the right word; a characteristic of a surviving species that isn't particularly relevant to the question of why they survive. While debate goes back and forth between the various potentially-vestigial organs we may possess, it seems clear that if the appendix contributes anything to humanity's survival, it isn't very much. Also, vestigial tends to imply it isn't actively harmful, which I don't think it is because PHP certainly works just fine with other models as well. (If it were only page-as-program, I'd have another opinion... but it would probably also not be doing anywhere near as well on very large sites and we probably wouldn't still be talking about it as anything but a historical language.)

You may disagree that my characterization is correct, but it is certainly the characterization I intended to convey. That's why I parenthetically commented that I think the real reason it has carried on is another one, to contrast the relevant characteristics to the irrelevant ones. Creating a new "PHP-killer" and focusing too much on the vestigial features of PHP is a recipe for failure.


I think z92 is on to something.

Ease of install is part of the same pattern. PHP has always been easy (with connections to a free database), and got easier with good package management systems. What's coldfusion like for ease of install, ease of install with database access?

ASP for Windows was huge. It was even easier to get started on than PHP because you just needed to install IIS from a EXE and you could reference access files. The only reason it's not still massive is that MS moved on.


To further your point, if C# MVC4 ran flawlessly on a free and open mono/nginx type setup, I'd run to it like a forlorn lover across an open meadow.

There are alternatives, but nothing that simply 'just works' like PHP seems to.


I think the argument being made here is not that page-is-program model is superior; it's that it's much easier to understand for newbies coming into the field.


Are you seriously basing a whole argument on what the hello world program looks like? That has nothing to do with actual real world programs. Mixing logic & presentation might make it easier to get something running quickly, but it's one of the downsides of PHP that these things get mixed up when they probably shouldn't for a project of reasonable size. The whole idea that it's an advantage of PHP that you can get something up and running so quickly is wrongheaded. Actually, it's much better if it requires some amount of thought and planning to code something up because that increases the likelihood that you'll do it right the first time and build on a solid foundation.


> Actually, it's much better if it requires some amount of thought and planning to code something up because that increases the likelihood that you'll do it right the first time and build on a solid foundation.

This is solid advice for an engineer. And absolutely moronic for a businessman.

Choosing what platform to use is a business decision.

If you take too long to get it right, you will never get the chance to make a dime off of your work.

We are all working on limited time frames. It is far better to throw something together that works and rewrite later, when you're actually making money.

PHP is amazing at letting you write something fast and rewrite it into something more manageable later.


> PHP is amazing at letting you write something fast and rewrite it into something more manageable later.

From experience, the mountain of technical debt organizations acquire when starting with PHP can make it near impossible to rewrite it into something more manageable later, and it's a false dichotomy to claim PHP lets you write something fast while the alternatives do not.


Plus, if you're trying to get new people to use your language, having a complex toolchain is going to scare them off.

"Hey kid, first one's free"


That's true only if your audience is well-educated engineers with plenty of experience under their belts working on projects with substantial backing.

Unfortunately, nobody starts out well-educated and experienced. And many projects start out small and grow. If you want to make your platform a broad success, you need to have a good experience for noobs and quickies. PHP is an abomination as languages go, but it's massively successful because any idiot can quickly get something basic up.


It is not that support is completely non-existant. Ruby, for instance, can be executed in a PHP-like fashion using ERB.

    $ echo 'hello world' | erb
    hello world
    $ echo 'hello world' | php
    hello world
If a new user could throw index.erb up on a server and have it execute in a Ruby context, would we be any further to supporting better development practices? Will the user take that experience and move into a framework like Rails later? If yes, what has stopped them from using the similar PHP frameworks that will already take them away from the comfort of the single page template?

If you truly only need a single page template without any further abstraction, then why not use PHP? It seems all of the complaints about PHP stem from using it in big projects. It is hard to argue that it does a single page template very well for when that is all you need. Right tool for the job and all that.


What people continue to fail to explain is why PHP needs to be replaced.

Why not improve it? After the millions of man hours that have gone into the plethora of open source PHP based frameworks and tools (aka, what powers the internet) - wouldn't we as a community want to improve the foundations rather then scrap them entirely?

You know, like what happened with Javascript...


When you "improve" inconsistency and misfeatures, you're essentially replacing anyway. Else you're building a mess of backward compatibility like in the fopen() example in http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de...


The one thing that can never be fixed is a poorly chosen feature.

PHP has a lot of them. And they interact badly.


Yes, but...

All languages (like any system) will have cruft, after a while. Is the solution really to do a periodic break with backwards compatibility for purity reasons, Python 3 style?

There should be a better way?!

What about a low level machine like Java/.Net and just let the next language evolve on top of that -- so old libraries could run? (Maybe there could be Xcompilers for Ruby/Perl 6/xxx to the Perl "bytecode", to take advantage of CPAN?)


Some things simply can never be fixed.

Figuring out when that happened to you is a judgement call.


List them out, explain them, show your work...

If us PHP developers have such bad judgement, show us the error of our ways.

And do not link to some other persons blog post - explain it yourself.


Why should I bother following your demands? If you've ignored a million blog posts that clearly explain it, you'll ignore me as well. And if you don't have enough experience of better programming languages that the warts are obvious, then what I could have to say would make no sense to you. To you it would be just the way things are - even though they aren't that way for other developers in other languages.


This strikes me as an example of the sunken costs fallacy.


> Rather it's simply: hello world

Wouldn't that also apply to jsp, cfm, gsp, jsf and asp?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: