Live data from Hacker News

PHP: A fractal of bad design

me.veekun.com

291–300 of 514 posts

Re: PHP: A fractal of bad design

#291
post #280

Earlier quoted context omitted.

It seems that many people disregard the fact that PHP is a very accessible language to a programming newcomer. You can quickly and easily install LAMP or MAMP and in minutes have a working, dynamic web page (albeit local) along with a plethora of examples and tutorials. This is huge. This shows the newcomer that this mysterious code stuff is actually accessible; that they can create something that works. That's a nic…

More programmers===better programs. How can this be a bad thing? I'm not sure this is true. Going with the articles example, that's like saying "the more people who know how to use a hammer, the better houses we will have".

No, but the more kids who have exposure to an easy-to-get-started language will result in more kids that are actually really into it getting that early start they need.

Re: PHP: A fractal of bad design

#292

Earlier quoted context omitted.

PHP is not a good tool for quickly getting a minimum viable product. Despite its flaws it is a good weapon for fighting 'the last war' - that is to say, it makes it quick and easy to make what are essentially the CGI pages of 1996 - but if you're doing anything more complex than that (for instance interacting in any way with a database), and I would suggest that even relatively non-technical people looking to use com…

What would you recommend as a starting language to build a MVP? The extent of my experience is html/css, manipulating wordpress php files, and a weekend hacking together a couple of learning projects (a PHP blogging platform and a "rank this list of items by number of upvotes/this number" website). Given my past experience I was planning to use PHP as it is the only language I have any experience with and while the f…

This, please.

Re: PHP: A fractal of bad design

#293
post #264

If this one thing that annoys me on HN it's the pervasive anti-PHP snobbery. A selection from the OP: > Because of the @, the warning about the non-existent file won’t be printed. So your complaint is that when you use @ to suppress an error it... suppresses the error? > The language is full of global and implicit state. "Global" is one of those dogmatic points. Nothing is truly "global" in PHP. The "global" in PHP j…

> So your complaint is that when you use @ to suppress an error it... suppresses the error?

From your edit, you've only been working with PHP for about 6 months, so you may not have seen some of the code most others have. Can you imagine, then, diving into a website's back-end to see @ all over? It turns out, the previous developer realized all those nasty notices and errors stopped happening if he slapped a @ on everything. Now your client/boss/friend is pissed because when someone submits their form and they have a space in their name, the entire site crashes, and you have to figure out what's causing it through a tangled web of spaghetti code with no errors.

This is the norm in PHP because, like the author said, it makes it incredibly easy to write bad code.

> If this one thing that annoys me on HN it's the pervasive anti-PHP snobbery.

This isn't anti-PHP snobbery. To write it off as such is an attempt to dismiss most of the (quite valid) complaints. And complaining about someone complaining is really only highlighting your own hypocrisy.

As you said, you really don't understand his need to complain. That's fine, but many on HN do. This was a great write-up for all of PHP's downfalls. Some of it is really only complaining about how PHP isn't Python, but there are a lot of fantastic points about language design and how PHP sacrifices consistency for... really no reason at all. So don't assume every complaint about a language is "snobbery" or an attempt at "streed cred" (wut?) Instead, ask yourself why there are so many people writing so many complaints about this one language. Then, ask yourself why you're writing them off.

Re: PHP: A fractal of bad design

#294
> PHP is a community of amateurs. Very few people designing it, working on it, or writing code in it seem to know what they’re doing. (Oh, dear reader, you are of course a rare exception!)

This was about when I stopped caring about what the author had to say. The sentence where he snobbishly belittled me and called me an amateur because of the programming language I use.

Re: PHP: A fractal of bad design

#295
I'm building a developer oriented platform using PHP. I made the decision to use PHP mostly for market size. If I targeted, say, Python or Ruby developers, my market would be too small to make a significant business.

The PHP eco-system (largely made up of platforms and templates) is huge. Ignore it at the peril of your revenue.

Re: PHP: A fractal of bad design

#296
PHP gets a lot of hate for the same reason that Microsoft gets a lot of hate. PHP could have been rewritten from scratch and made more orthogonal but it would have immediately broken every existing PHP application out there. For better or worse, the install base matters. Once you a function/feature it's there to stay or you can't ever upgrade your server.

Re: PHP: A fractal of bad design

#297

Earlier quoted context omitted.

Why is PHP more likely than others to be vulnerable to SQL injection attacks? Most people (and likely All newbies) will be using PDO which automatically protects them.

This is why: http://www.google.com/search?q=php+mysql Searching for PHP and MySQL yields tons of tutorials, code examples, and documentation related to the now-deprecated mysql interface. When I wrote my first comprehensive PHP application last year I spent half a day trying to determine best practices before finally settling on PDO. Newbies won't go through that effort, and will naively land on mysql rather than PDO…

There's a lot of tutorials, and that makes PHP bad? Sure the tutorials don't teach what you prefer. This just seems like a silly argument.

Re: PHP: A fractal of bad design

#298
post #264

If this one thing that annoys me on HN it's the pervasive anti-PHP snobbery. A selection from the OP: > Because of the @, the warning about the non-existent file won’t be printed. So your complaint is that when you use @ to suppress an error it... suppresses the error? > The language is full of global and implicit state. "Global" is one of those dogmatic points. Nothing is truly "global" in PHP. The "global" in PHP j…

It seems that many people disregard the fact that PHP is a very accessible language to a programming newcomer. You can quickly and easily install LAMP or MAMP and in minutes have a working, dynamic web page (albeit local) along with a plethora of examples and tutorials. This is huge. This shows the newcomer that this mysterious code stuff is actually accessible; that they can create something that works. That's a nic…

I agree with the general point but this seems more of an indictment of other languages than a plus for PHP: with PHP, it's easy to get started with the most simple features - and then it takes years to learn how to cope with the language quirks and inconsistencies, deal with outright bugs, and learn a number of non-obvious ways in which your “working” site might be hacked due to a hidden language feature.

There are two ways in which this could be dealt with: one would be for PHP to have a change of religion by the core developers and start a massive cleanup project fixing API warts, adding placeholders to or deprecating the default MySQL driver, etc. This wouldn't be easy but it wouldn't be especially difficult except that the core developers are usually hostile to suggestions that they fix, or even document, mistakes.

The other would be for other languages to start simplifying the learning process - Google AppEngine is probably the easiest intro of all, albeit with a severely non-standard architecture, Rails.app, etc.

I think a language like Python or Ruby is likely to gain a smooth dev server install before PHP becomes less treacherous.

(Pro-PHP flamers: I started using PHP back in 1999. Your arguments are not new.)

Re: PHP: A fractal of bad design

#299
What's worse than PHP, people that complain about it. It's like a plumber complaining about copper in lieu of plastic, no one gives a shit, just get the job done. Sitting in your little complaint hole , no matter how well thought out, doesn't really help you does it?

Re: PHP: A fractal of bad design

#300
post #264

If this one thing that annoys me on HN it's the pervasive anti-PHP snobbery. A selection from the OP: > Because of the @, the warning about the non-existent file won’t be printed. So your complaint is that when you use @ to suppress an error it... suppresses the error? > The language is full of global and implicit state. "Global" is one of those dogmatic points. Nothing is truly "global" in PHP. The "global" in PHP j…

Your main "defense" of PHP's flaws consists of saying "other languages suck similarly". Well congratulations, PHP is apparently a "worst-of" of programming idioms. I like me some caviar with my programmes.
Post reply on HN