Live data from Hacker News

PHP: A fractal of bad design

me.veekun.com

351–360 of 514 posts

Re: PHP: A fractal of bad design

#351
post #293

Earlier quoted context omitted.

> 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 eve…

> 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. You've turned something that's a person's fault into something that's the language's fault. Other languages have some sort of warning suppression as well, like Java's @SuppressWarnings or C#'s #pragma warning di…

"You've turned something that's a person's fault into something that's the language's fault."

Out of curiosity, where do you side on the C-is-an-unsafe-evil-language-because-of-pointers debate?

Re: PHP: A fractal of bad design

#352
post #293

Earlier quoted context omitted.

> 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 eve…

> 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. You've turned something that's a person's fault into something that's the language's fault. Other languages have some sort of warning suppression as well, like Java's @SuppressWarnings or C#'s #pragma warning di…

"You've turned something that's a person's fault into something that's the language's fault."

Out of curiosity, where do you side on the C-is-an-unsafe-evil-language-because-of-pointers debate?

Re: PHP: A fractal of bad design

#353
post #318

Earlier quoted context omitted.

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…

I'd say that using Ruby with Sinatra is really easy to pick up - the documentation of Ruby itself is great and Sinatra is also documented really well, not that i think it's particularly complicated. Use an easy template-engine or stick with the default (erb) and (at least for the beginning) the sqlite-gem. Of course, that was my impression given my prior knowledge, which of course influenced my start with that enviro…

Or you could stay with PHP and use Silex and Twig.

Re: PHP: A fractal of bad design

#354
post #337

Earlier quoted context omitted.

Pointing out "giant" flaws which don't really matter and can't be fixed for 1000th time is very useful for... remind me please, what exactly purpose?

Convincing people to stop using such a flawed language when there are so many viable (and in nearly all ways preferable) alternatives.

Obviously, since millions of people are using it it is preferable for them. Of course, this is only because they are too stupid to agree with you and have the exactly the same criteria and preferences that you have. It can't be that intelligent people can disagree with you on what is important and what is not in a language. It's clearly either you didn't explain it to them or they're too stupid to understand. Let's write another "PHP sucks" article, that will do it.

Re: PHP: A fractal of bad design

#355
post #334
post #293

Earlier quoted context omitted.

> 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 eve…

"This is the norm in PHP because, like the author said, it makes it incredibly easy to write bad code." PHP makes it extremely easy to write ANY code. But since article saying "I've noticed this piece of good code in PHP" is not going to get on HN anytime soon, you get much more attention to bad one. That's like saying Internet is the source of filth because it makes easy to post bad stuff. It makes easy to post all…

> PHP makes it extremely easy to write ANY code.

No. PHP makes it easy to write bad code and between normal and challenging to write normal code. This is why Doctrine, the closest thing PHP developers have to SQLAlchemy, needs three ways to declare table and column metadata: a separate YAML file, a separate XML file, and in PHP comments. All three of those methods are awful, and only one allows you to keep the metadata and class in the same file.

> These "downfalls" are known and discussed 1000 times.

And, like a wiki, it's useful to have them all in one place.

Re: PHP: A fractal of bad design

#356

Earlier quoted context omitted.

Read his profile and you will see Java, Python, and C and he works at Google.

More than half of the top level comments are from people who use PHP. You can tell by how they rush into PHP's defense and try to argue against the article. The original post just can't be sensibly called "anti-PHP snobbery". It just points out PHP's shortcomings. But when all these PHP-users can't really attack the truth, they attack how it's presented instead (and of course whip up some strawmen and generally just…

(I didn't downvote first off)

PHP devs certainly know its shortcomings like JS guys know that languages too. It's not the fact that he points out the shortcomings, that's fine. What makes it snobbery is how the author points out flaws and is so passionately anti-PHP with the subtext being "what I use is superior". He points out flaws in his preferences but in a way that makes it seem like flaws in Python are acceptable but flaws in PHP are never acceptable.

A lot of people who "point out PHP's shortcomings" are really just on a mission to make themselves and their preferences superior. It's a big pissing contest and these arguments come and go like how JavaScript was once despised and now loved.

Re: PHP: A fractal of bad design

#357
post #344
post #330

Earlier quoted context omitted.

In PHP, if you forget the check, and have error reporting turned off (which you should), you'd never KNOW you forgot the check, because missing it is only a logic error, whereas an exception blowing up a python script will be caught by the runtime.

> have error reporting turned off (which you should) No, you should not. You should never have error reporting turned off. You should certainly have it set to not display errors to the client, but all errors should be sent to a log, preferably syslog, and they should be reviewed. Your code shouldn't generate any errors.

"You should never have error reporting turned off."

Ha. Ha ha. Ha ha ha.

Tell me more about maintenance programming and legacy production systems.

Re: PHP: A fractal of bad design

#358
post #337

Earlier quoted context omitted.

Pointing out "giant" flaws which don't really matter and can't be fixed for 1000th time is very useful for... remind me please, what exactly purpose?

Oh, you mean as opposed to the usefulness of calling people snobs because they understand that PHP is terribly designed? Fuck outta here.

There are a lot of snobs out there. It is a sad fact, regardless of that article. PHP snobbery is hugely widespread and 99.9% of people disparaging PHP are completely ignorant in PHP and don't bother to spend a minute even on reading the PHP manual - which answers 99% of things they complain about as being hard to understand (and try using Python without reading any manuals at all - see how far you go). I'm not saying PHP is perfect - it is not. I am saying if you take time to write a long article about PHP deficiencies while refusing to take 10 seconds to look up a thing in the docs - it doesn't look good.

PHP has some wrong design decisions, however many of them don't really matter (like function called strpos instead of str_pos - really, that's your problem?). Some do, and people are welcome to propose solutions for them. People also welcome to write rants about "PHP sucks, nobody should use it, anybody who uses it is an idiot" but they shouldn't expect this will be taken seriously.

Re: PHP: A fractal of bad design

#359
I'm no programmer. I'd consider myself more of a designer and marketer. But I plan on creating a SAAS app soon and I was planning to use PHP for one main reason in that our billing system will be PHP (WHMCS) and our CMS will be php (WordPress). I think this is one of the advantages of PHP in that there is a lot out there already created in PHP. Is PHP really this bad that I should consider using something like ruby instead? My worries are finding good talent that want to work on a custom php application a few years down the road when we expand. And of course I'd want to be more likely to prevent bad code and build something that will be future proof. Thoughts? How screwed are new companies that start building php applications today?

Re: PHP: A fractal of bad design

#360

All those words, and yet the word template only appears once. And that's to assert that PHP has: …no template system. There’s PHP itself, but nothing that acts as a big interpolator rather than a program. As if that was a bug and not a feature. PHP succeeds because there is one PHP templating syntax and it is called "PHP" . PHP started life as a templating language, and that's where its soul lies. Which is important,…

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…

Sorry but that is quite hard to swallow.

How are any of these not fit for building an MVP in 2012?

http://silex.sensiolabs.org/ http://twig.sensiolabs.org https://github.com/nrk/predis

There are also modern libraries for a plethora of other RDBMS and NoSQL systems (I think PHP is even going to support mongodb natively soon i.e. no third party client library required).

Post reply on HN