Live data from Hacker News

PHP: the quiet powerhouse

blog.appfog.com

111–120 of 140 posts

Re: PHP: the quiet powerhouse

#111

Earlier quoted context omitted.

I'm really not sure why this is being downvoted. It's not trollish. I believe what I'm saying to be true: mobile is increasing, and this is leading to thicker clients and more JavaScript and therefore less server-side view logic. Please correct me if I'm wrong, but downvoting me is confusing.

Mobile devices can cope with even less client-side logic than real computers can. Why would mobile devices lead to pushing more work onto the client? Disclaimer: I'm not one of the downvoters.

Thanks for the courtesy of a constructive discussion. :)

Yes, that's a valid point, if you mean that smartphones have less resources (memory, CPU) to handle JavaScript execution. But keep in mind that a native smartphone app is a thick client; it has all of the view logic.

Perhaps I need to back up and explain my point better. Maybe people are misunderstanding me because they think I'm talking about what's going to happen in the next few months. Server-side view rendering is not going anywhere anytime soon. But it's on its way out in that it's an anachronistic way of thinking about the web; it's a relic of the past--of the time of web "pages"--and not of the future, of web "apps" and "resources". As long as you are serving content that's primarily to be "read", like articles, books, blogs, etc., server-side rendering has its place.

But look what's happening to the web. Native iPhone apps have to store their data somewhere, so they communicate to the backend via an API. Cars are reading Twitter. Thinking about the past of the web, only browsers consumed web content. Now non-browsers consume web data via APIs, and I see this trend as increasing.

I see a trend where more web apps will be like a "smart database in the cloud", meaning they hold data and business logic and communicate via JSON APIs. There may be a variety of client devices accessing this data in the cloud: native iPhone apps, desktop browsers, other Internet-enabled devices.

The main point is that clients are no longer only browsers. The clients could be a variety of devices running on a variety of operating systems. So it doesn't make sense for the server to render the view and send it down the pipe for the client to display. It makes more sense for the server to send data to the client and the client to decide how to render it.

I'm not claiming that server-side view rendering will go away completely; it has its place with articles and blogs. But with apps, I see a movement toward thick clients and I don't see this trend slowing down. It's hard for me to envision a world in 10 years with less smart phones, less devices hooked to the Internet, and people only accessing web apps and web app data with browsers.

Let me also put this in context of the article's original point, that PHP has a nice feature of being able to be embedded directly in HTML. Yes, this is nice. But my point is that if you are starting your web career and therefore are looking toward the future, the types of web sites that will use inline PHP will be more like content sites and less like web apps. And I expect a bigger demand, higher pay, and arguably more interesting work for web app creators than web content site creators.

Re: PHP: the quiet powerhouse

#112

Earlier quoted context omitted.

Agreed, it will be hybrid for a long time, but I expect the trend toward view logic being more on the client and less on the server to continue, simply because the web is less and less about "pages" and more and more about "apps" and "resources".

I don't understand this argument. The way I use server side templates is much simpler and more powerful than any demo of client side templating I've seen. I think you're reading a little too much into the hype, otherwise maybe you can share an example of superior Javascript templating patterns because I can't find them.

It depends what you are trying to do. If you are only targeting browsers, and especially if you don't need a lot of responsiveness, it's much simpler to just render views on the server side and optimize your server for speed. It takes a lot of effort to write a thick client.

But if you are targeting a browser and a native iPhone app, the view logic lives on the iPhone app. It used to be that you could just serve up a web page and assume that your client was a browser. Not anymore, and that's my point. And my point is that the trend will continue: I think we will have more variety of non-browser clients in the future, not less. Your car, refrigerator, geranium, etc. will all be hooked up to the web.

Keep in mind that I'm not talking about whether you should create your web app in Backbone.js today, but I'm looking years into the future, anticipating trends.

Re: PHP: the quiet powerhouse

#113

Here's an idea.. If PHP is so bad.. Don't use it. Simple as that. Let the people who want to use it... There's absolutely very minimal things wrong with the language. Everyone's quick to compare it with Python or Rails or something else saying "PHP does this wrong that Python does right" well, if PHP did everything the same way as Python, Rails, or something else, when what makes it different? Who wants to use a lang…

Some of the problems with PHP are things that are problematic or irritating to development (e.g. its inconsistent standard library) but other things are actively dangerous to security and correctness. For example, in PHP, '9223372036854775807' == '9223372036854775808' returns true.[1] Now imagine those two strings are hashed passwords. The overall problem is not with specific flaws of PHP; the problem is that flaws i…

Blame the developer not the language...

Re: PHP: the quiet powerhouse

#114
post #95

Earlier quoted context omitted.

Just like Python, Perl, Rails, Node.js, and any other language out there. Why all the hate towards PHP?

"Rails" isn't a language, and PHP has fundamental design flaws that those other languages don't have. It's not that it has flaws, it's that it has unavoidable flaws.

Every language has flaws, may not be the same, but they still do... I am sure I can go dig up enough flaws in Python to write an article totalling 960 words on why it's so crappy too... But I am not, because it's dumb to nit pick at one language just because YOU don't like to use it.

Re: PHP: the quiet powerhouse

#116

http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de... 9600+ generally concise words on many, but not all, of the issues with PHP. As a summary, PHP isn't "out of fashion" as much as people are tired of continuously being misled and abused by their language of choice.

That is unfortunately a terrible article. It's probably 33% accurate, 33% the author being confused, and 33% just plain wrong. Continuously trotting it out on every discussion on PHP does everyone a disservice.

Re: PHP: the quiet powerhouse

#117

Here's an idea.. If PHP is so bad.. Don't use it. Simple as that. Let the people who want to use it... There's absolutely very minimal things wrong with the language. Everyone's quick to compare it with Python or Rails or something else saying "PHP does this wrong that Python does right" well, if PHP did everything the same way as Python, Rails, or something else, when what makes it different? Who wants to use a lang…

Some of the problems with PHP are things that are problematic or irritating to development (e.g. its inconsistent standard library) but other things are actively dangerous to security and correctness. For example, in PHP, '9223372036854775807' == '9223372036854775808' returns true.[1] Now imagine those two strings are hashed passwords. The overall problem is not with specific flaws of PHP; the problem is that flaws i…

php > var_dump('9223372036854775807' == '9223372036854775808'); bool(true)

This made me cry.

Re: PHP: the quiet powerhouse

#118
post #79

Back when all you had for choices were Perl, Java, and C++ it was easy to see why PHP got big. However there are issues with starting out on PHP now: 1) It's really only meant for web development. 2) There are other languages now that are simple to learn, flexible (more than just for web apps), and powerful (Python, Ruby, and now even Javascript) Unless PHP has another major evolution, like its move to OO; (or unless…

Agree with all your points except this one. >> Maybe all of this will change once Facebook releases Hiphop VM AND people actually start using it. The argument that PHP doesn't scale is a strawman. To scale anything to the likes of Facebook or Google you have to have serious architecture in place regardless of the language you choose.

I wasn't thinking of scale. Correct me if I'm wrong, but wouldn't hiphop VM essentially expand PHP from just being a web language into something more?

Re: PHP: the quiet powerhouse

#119

Back when all you had for choices were Perl, Java, and C++ it was easy to see why PHP got big. However there are issues with starting out on PHP now: 1) It's really only meant for web development. 2) There are other languages now that are simple to learn, flexible (more than just for web apps), and powerful (Python, Ruby, and now even Javascript) Unless PHP has another major evolution, like its move to OO; (or unless…

I've been working with PHP since 1996 and rarely see eval being used. I've worked with hundreds of companies training PHP developers, seen inside (and written) some very large codebases handling millions of dollars of transactions, and don't recall seeing eval in any of them. "it was easy to see why PHP got big" It's easy to see why it's staying big: 1. cheap shared hosting to get started 2. most hosts offer one-clic…

> I've been working with PHP since 1996 and rarely see eval being used.

For some reason most of the major frameworks use it, hence their incompatibility with hiphop; then again I could be wrong.

> 1. cheap shared hosting to get started

One can argue that all of the major languages have access to this. PHP doesn't have an edge in this area.

> 2. most hosts offer one-click installation of any sort of application people need on the web (blogs, shopping carts, calendars, social networking, file hosting, etc)

With the rise of the cloud hosts and automated config, as well as more automated tools available (e.g. Chef, Puppet), this is a temporary advantage. Deploying on Linode and Heroku and (insert cloud host company) are getting easier and easier.

> 3. 15+ years of knowledge about what works and what doesn't when attempting to scale PHP to large needs.

No argument here. My points only apply for people starting now, and not for PHP vets.

> 4. ubiquity which keeps a large pool of reasonably priced talent available, which perpetuates the cycle.

No argument here either. My points were being made for individual programmers who are just starting out, and not for companies.

Even from the point of a company though, PHP's current lack of flexibility lowers the chance of innovation imo. The other dynamic languages are just as easy to learn and they just offer more than PHP does.

Re: PHP: the quiet powerhouse

#120

Earlier quoted context omitted.

Mobile devices can cope with even less client-side logic than real computers can. Why would mobile devices lead to pushing more work onto the client? Disclaimer: I'm not one of the downvoters.

Thanks for the courtesy of a constructive discussion. :) Yes, that's a valid point, if you mean that smartphones have less resources (memory, CPU) to handle JavaScript execution. But keep in mind that a native smartphone app is a thick client; it has all of the view logic. Perhaps I need to back up and explain my point better. Maybe people are misunderstanding me because they think I'm talking about what's going to h…

You seem to confuse server side rendering for page based apps, these are unrelated. I can build fully dynamic Ajax pageless applications that are effectively just as snappy as anything you can with client side rendering while keeping all rendering on the server. Rather than sending down json, I'd just send down rendered fragments of HTML and update the contents of some tag.

It's a vastly simpler approach that makes client side code nothing more than update this or that, and works just as well while allowing the traditional server side templates. It's not a relic of the past and it's not on it's way out, nor is it inferior to client side rendering, in fact I think it's better.

Post reply on HN