Live data from Hacker News

Stack Overflow: Defend PHP - convince me it isn't horrible

stackoverflow.com

41–50 of 74 posts

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#41
It's a little pointless to defend PHP to someone who thinks it's horrible.

That's like asking someone to defend a religion. A waste of time and energy.

In a good programmer's hands, the results will be good, regardless of language or platform choice.

Sure, you can argue the finer points until you're blue in the face, but in the end, the only thing that should matter to your "customer" is that the solution satisfies his/her needs.

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#42
The real advantage of PHP is deploy-ability.

If you choose mod_perl, mod_python, JSP, or most of the classic environments you need a sysadmin to take care of the web server... It's going to crash from time to time, run out of memory, and otherwise make trouble for you.

PHP's mode of integration with the prefork Apache web server is almost trouble-free... It's such a big difference that there could be a "blub" factor here... People who program in other environments often have a really hard time believing that a large fraction of the sysadmin activities that they are doing just don't need to be done if you're running PHP. (You can go five years and never "kick Tomcat", something that some shops have to do every 5 hours).

That said, scaling comes to play here. For a small company or for a company that's doing a number of small projects, the cost of system administration that comes with other programming environment matters a lot more than it does for a big company. It's not such a big factor for a company like Facebook.

On the other hand, PHP forces people into a "shared nothing" model that scales well and ~eliminates~ a wide range of concurrency-related problems that are endemic to thread-based backend apps. For instance, quite often I've seen a race condition in an ASP.NET app and had everybody on the team swear up and down that there's no shared state, then I spend a few hours looking at the app and there's a static variable that nobody knew was there.

Another strength of PHP is that it has a very complete library that's largely correct. The PHP team is much more honest about what works and what doesn't work than a lot of others (PHP and Python have the same problem with threads, for the same reason -- PHP says "don't use them", Python says "jump in the water is fine".) If you program in some weird-o language like Haskell you'll probably have to write your own urldecode function and you'll probably be so busy thinking about higher-order functions you won't pay attention to details... Like making it work right. (Perl has a broken urldecode function in CPAN FOREVER)

Don't get me wrong, there's plenty to hate about PHP; but try to get some real work done in environment X and you'll find plenty to hate too.

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#43

PHP may be one weird concoction, that's for sure, but all of the arguments brought up by this guy - and this is the exact same boring song belched out whenever there's an argument of "PHP is a terrible language" - fall into the category of vanity, because no matter how one twists and turns these points they still really don't make the language itself terrible, and they don't make PHP one bit less capable, nor one bit…

What do you mean?? Do you have any idea of just how many programmer hours have been wasted by the absence of features, just how insecure so many web apps are due to the weird casting system and lack of safety-oriented features.

My impression is that people who claim PHP has not cost them development time have simply never looked at alternatives that solve many of the problems.

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#44

PHP may be one weird concoction, that's for sure, but all of the arguments brought up by this guy - and this is the exact same boring song belched out whenever there's an argument of "PHP is a terrible language" - fall into the category of vanity, because no matter how one twists and turns these points they still really don't make the language itself terrible, and they don't make PHP one bit less capable, nor one bit…

What do you mean?? Do you have any idea of just how many programmer hours have been wasted by the absence of features, just how insecure so many web apps are due to the weird casting system and lack of safety-oriented features. My impression is that people who claim PHP has not cost them development time have simply never looked at alternatives that solve many of the problems.

Without going off on a limb, I'm guessing you're a not too experienced developer. You comment as if instead going for Perl, Ruby or ASP inherently makes an application safe, saves buttloads of manhours etc. And you're wrong. Gravely wrong.

Excluding the obvious issues caused by bugs that are a natural part of any programming language's development, security problems are not caused by the language chosen, but by the developers themselves.

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#45
post #38
post #15

These topics always just smell of "Now I'm a grown up programmer I'm going to tell the world how much I understand by slamming an easy target language". I love PHP and have used it for years since moving away from asp.net and agree with some of the posters arguments as a theoretical principle, but as day-to-day PHP developer I also say so what. Naming and parameter inconsistencies? Yes, my libraries have that too and…

Agreed. Fwiw, many of the complaints apply to other "better" languages also: - PHP has inconsistent naming of built-in and library functions. - C has types like int, size_t, jmp_buf and FILE - PHP performance is abysmal without caching - MRI Ruby is pretty slow too - Functions are case insensitive - Lisp anyone? etc etc The whole meme of PHP warts seems more like an exercise in confirmation bias than objective analys…

Yeah, but if we continue that logic and fill up that "etc etc" it would seem that the other languages have their own bad features and PHP combines them all.

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#47
post #38
post #15

These topics always just smell of "Now I'm a grown up programmer I'm going to tell the world how much I understand by slamming an easy target language". I love PHP and have used it for years since moving away from asp.net and agree with some of the posters arguments as a theoretical principle, but as day-to-day PHP developer I also say so what. Naming and parameter inconsistencies? Yes, my libraries have that too and…

Agreed. Fwiw, many of the complaints apply to other "better" languages also: - PHP has inconsistent naming of built-in and library functions. - C has types like int, size_t, jmp_buf and FILE - PHP performance is abysmal without caching - MRI Ruby is pretty slow too - Functions are case insensitive - Lisp anyone? etc etc The whole meme of PHP warts seems more like an exercise in confirmation bias than objective analys…

Yeah, the minor details of PHP don't really matter. It's the whole language and ecosystem when viewed as one that is really repulsive. It's also difficult to write good code, because there are no abstraction mechanisms.

Well, there's one -- Java-style OO. But incidentally, Java is almost impossible to use for the same reason.

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#49
post #14
post #8

Earlier quoted context omitted.

...or big thing running yesterday, right? Take Facebook for an example. To me, Facebook seems like a pretty complicated piece of software. The concept isn't very complicated but there are so many features all over the place.

He didn't say you _can't_ use PHP for such things, he said PHP is "great" for getting smaller sites built quickly. It's possible to build very large apps with PHP alone, if you like, but there are other solutions I think are preferable. Most of them weren't even available when Facebook was born. For example, I would rather build a Facebook-sized app in Rails than a PHP framework, especially with Rails 3's new feature…

Rails would get you started on Facebook app quicker, but then you'd be forever fighting the framework to do things outside of it's core abilities. For something as large as Facebook, that will be all the time.

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#50
post #13

I'm spending most of my time maintaining a web application consisting of around 150k lines of PHP code. We (well - initially, it was just me) began development back in 2004 but since then the application has grown constantly. Back in 04, I already felt some reservations against PHP, but that's what I knew best and that's what was most used for the web (Rails might have been around, but not really known - other ruby o…

> What really disturbs me about PHP is its type conversion rules. 1 == '1' or even worse 'foobar' == 0, or '123n' == 123. This is cause for so many subtle bugs.

Weird cases like 'foobar' == 0 are extremely rare and 1 == '1' is actually what you want most of the time. I've learned to embrace the type-less nature and use casts when I absolutely want to ensure a particular type. I no longer even consider this a problem.

Post reply on HN