Live data from Hacker News

High Quality PHP

acquia.com

61–70 of 98 posts

Re: High Quality PHP

#61
post #49

I believe "high quality PHP" is an oxymoron. It's just impossible to be aware of all the pitfalls PHP contains. Here is just one example among many: > if( '33333333333333333333' == '33333333333333333334' ) echo "equal"; Output: "equal" The "reason" for this very odd behaviour is that the two strings are automatically converted into integers, which leads to an int overflow, which PHP ignores (ignoring errors is very P…

I just tested this (PHP 5.4) and I don't get this behaviour. In this example the two are compared as strings not integers so are not equal.

PHP does not automatically convert types unless you do something like this:

if( 33333333333333333333 == '33333333333333333334' )

But here the problem is the integer overflow not specifically the type conversions. You are going to get weird behaviour no matter what you do because you don't have enough bits to store that number.

If you want to use numbers this size then you are going to need some type other than the standard int.

Re: High Quality PHP

#62

Earlier quoted context omitted.

This argument makes no sense. You're conflating people and behavior with tools. Bad tools make it easier to do a bad job in any field of work. Novices with good tools will still do a bad job. This is a weak justification for promoting bad tools.

Bad tools? In what alternative universe is PHP a bad tool? It is one of the easiest to get started with, most documented, best supported and flexible tools out there for 90% of the things you see on the internet today.

> In what alternative universe is PHP a bad tool?

In the same universe where munging together logic and display code, or model and view code, is a bad idea. It's the same problem as using classic .ASP, except people are smart enough to not get all indignant when people point out how bad .asp was.

> It is one of the easiest to get started with

That's nothing special. It's trivial to get started with dozens of web frameworks.

> most documented

Most frameworks and languages are well documented. It's like you're bragging that you have the most well-vacuumed car seats, at a car rally.

> best supported

Again, this is nothing special. Most frameworks have IRC channels and mailing lists.

> for 90% of the things you see on the internet today.

90% of the things on the internet are so simple that you could easily use PHP for them, like blogs, simple forums, mostly static sites, etc. That doesn't necessarily make PHP a good tool. It just shows how you can easily do trivial tasks with mediocre tools.

Re: High Quality PHP

#63

Author here. I wrote this article as a guestblogger for Acquia, which is the company behind Drupal. I don't work at Acquia. The article obviously uses Drupal as an example, PHPBB and Wordpress as comparison because they are all in the off-the-shelf, customizable category of PHP applications. Both Drupal and phpBB (contrast to Wordpress) have massively modernized their code bases in the last years and improved the qua…

Thanks for putting all this together. I recently find myself working with PHP again after last looking at it in 2003, and have been digging around getting up to speed.

All sorts of interesting things happening in this space, especially PHP-FPM and HHVM. The language design and code quality/organization capabilities may not yet be up to snuff with Python and Ruby, but the runtime options are as good or better.

Re: High Quality PHP

#64

Earlier quoted context omitted.

Obligatory http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de... I spent many years doing PHP. I am very glad that those years are behind me. Even if you allow for it being easy to setup - which is debatable - setup only happens once and is not very hard in any language. If you find it hard to install a programming language by following instructions, you are an amateur pretty much by definition.

Are there blog posts about how someone tried to solve an actual problem in PHP, but couldn't because the language sucked too much? You know, instead of pointing and laughing at things they saw in the manual or newsgroups that hardly matter in practice.

While we're at it, how about you dig up some blog posts where someone switched to PHP after failing with alternatives?

Re: High Quality PHP

#65
It still baffles me that whenever an article like this comes up, people still justify choosing PHP because of its ease of setup compared to other languages. Seriously? What are you going to tell me next, that you chose Ruby because the "Hello World" tutorial was 15 minutes shorter, than the Java one? Come on now.

Yes, the fact that PHP is easy to setup may explain its popularity, it doesn't however justify choosing it, considering that you may spend 2 or 3 days setting up a tool that you'll end up using day in and day out for the next couple of years, to do much more difficult things than just greeting the world on a blank web page.

Re: High Quality PHP

#66
post #48

Earlier quoted context omitted.

Are there blog posts about how someone tried to solve an actual problem in PHP, but couldn't because the language sucked too much? You know, instead of pointing and laughing at things they saw in the manual or newsgroups that hardly matter in practice.

That's not the problem with PHP. The problem with PHP is that its design flaws cause friction that scales at least linearly and probably more like geometrically with application complexity--and it doesn't hit you until a project is of sufficient size that every change comes with more and more pain. "It's easy to start with" is only a virtue if that doesn't come with "it turns into a tire fire a year later".

Fair enough, but not every application has to be ready for huge growth. E.g. for a guestbook the fact it wouldn't turn into a tire fire should you decide to turn it into facebickr or googipedia is a rather small benefit, and if it comes with higher setup costs it's actually a drawback.

Some people just scratch the itches they have, right now, not the itches their expertise makes them think they should have, or the likes of Google or Facebook make them think they might have in the future.

And that is fine. Nobody is telling anyone to use PHP for their huge project, right? So why tell people they shouldn't use PHP for their mortal ones? Because at some point, down the road... can't we cross that bridge when we come to it?

Re: High Quality PHP

#67

Earlier quoted context omitted.

Bad tools? In what alternative universe is PHP a bad tool? It is one of the easiest to get started with, most documented, best supported and flexible tools out there for 90% of the things you see on the internet today.

Obligatory http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de... I spent many years doing PHP. I am very glad that those years are behind me. Even if you allow for it being easy to setup - which is debatable - setup only happens once and is not very hard in any language. If you find it hard to install a programming language by following instructions, you are an amateur pretty much by definition.

That's a fractal of a bad and trite article.

Re: High Quality PHP

#68

Earlier quoted context omitted.

Are there blog posts about how someone tried to solve an actual problem in PHP, but couldn't because the language sucked too much? You know, instead of pointing and laughing at things they saw in the manual or newsgroups that hardly matter in practice.

While we're at it, how about you dig up some blog posts where someone switched to PHP after failing with alternatives?

Why would I? Where did I make an analogous claim?

Re: High Quality PHP

#69

Earlier quoted context omitted.

In a Universe where consistency, soundness, orthogonal API design, modularity and evidence that the developers gave some thought to their language is expected. I would like to believe that this is such a Universe. I mean, many of the endless list of functions imported into the default namespace were named so that their hashing distribution worked well with strlen for a hash. How much work went into working around the…

You are in the wrong universe mate. And you are missing the point. It's not just about the language it's about all the other things around the language. How easy it is to find a webhotel and get started, how easy it integrates with HTML, JavaScript, CSS. Of course it's ugly, but who besides a bunch of snobs and people who actually can't use it really cares? Who should care?

> How easy it is to find a webhotel and get started, how easy it integrates with HTML, JavaScript, CSS.

Good! We can see you clearly haven't tried using any of the many frameworks that easily integrate those things.

> who besides a bunch of snobs and people who actually can't use it really cares?

The people who later have to re-write these garbage projects, for one. I guess you've never had a client with a failed PHP project who needed the thing fixed. Also, people who do things more complicated than geocities pages.

Re: High Quality PHP

#70
post #65

It still baffles me that whenever an article like this comes up, people still justify choosing PHP because of its ease of setup compared to other languages . Seriously? What are you going to tell me next, that you chose Ruby because the "Hello World" tutorial was 15 minutes shorter, than the Java one? Come on now. Yes, the fact that PHP is easy to setup may explain its popularity, it doesn't however justify choosing…

There's a big difference between easy to set up (requires no setup) and a bit harder to setup (requires a different and more expensive ISP and then a bunch of extra effort).

The reason I picked PHP for a project years ago wasn't because it was easier for me to set up, but because it would be easier for users of my code to set up. If you're writing code to work on your servers that's a different thing altogether. Similarly I picked PHP for a later project simply because it was available and configured, whereas anything else would have had to go through approval and tech support.

For my personal stuff I use a shared server (dreamhost) which is pretty typical for low-end providers. PHP isn't merely easier, it's possible.

Now my professional stuff goes on dedicated servers, so that's great. But the problem with them is that when I want to tinker, I want something really simple and foolproof to work with. If I come back after not looking at a side project for several years, I'd like to not have to spend days figuring out the runtime setup.

We are getting close to a better world. I see a lot of pretty cheap/free and convenient options for hosting node and rails projects, but usually database access is yet another stumbling block.

Post reply on HN