Live data from Hacker News

PHP: A fractal of bad design

me.veekun.com

121–130 of 514 posts

Re: PHP: A fractal of bad design

#121

Sure, PHP is full of inconsistencies and irregularities. You know what else is? English.

Several people have brought this up. I thought about it for about ten seconds the first time and told them that English is definitely worse.

Luckily, programming languages are a bit easier to learn and replace than spoken languages.

Re: PHP: A fractal of bad design

#122
post #119
post #115

Earlier quoted context omitted.

> what makes PHP so great for beginners? From what I can see and aside from the ease of install, it is the namespace. You type Sometimes everything not being an object helps, but only in the short run. It's not great, but it's the easiest to grasp.

from * import

That's an additional magic incantation people have to learn to add to the start of every file. In PHP, that magic incantation is invisible because they never have to type it or even know that it exists.

Re: PHP: A fractal of bad design

#123

A nit: "Subclasses cannot override private methods. Subclass overrides of public methods can’t even see, let alone call, the superclass’s private methods. Problematic for, say, test mocks." IMHO you don't want private methods to be visible in subclasses, because this makes the fragile base class problem worse. If I'm a framework developer working on a UI library, I should be free to add private methods to my Button c…

Well, that's coming from the perspective of someone who doesn't like "private" in the first place; it forces me to rely on whatever use cases the author has imagined and makes extending the class in a novel manner a pain. Except this is PHP, so I can just go change the "private" to "public" anyway.

Namespacing within an inheritance tree is a problem, yes, but just hiding as much of your namespace as possible sucks. As does ahem ahem double-underscore prefixing. Surely there's another option here, but until someone figures out what it is, I'm okay risking collisions.

Re: PHP: A fractal of bad design

#124
PHP is just an interpreted C and standard libs all rolled into one. The first version was literally a set of macro's. PHP has baggage that other languages don't because of its immediate and rapid super popularity.

If you look behind each one of the features you will find that they aren't 'design decisions' but rather a consequence of circumstance.

Most of what is being discussed in this post doesn't really matter because:

a) most PHP developers will never touch some of the smaller nuances

b) newer versions of PHP are changing things (and people still keep using older version. there was an entire holdout movement with version 4). this entire post could have been pulled from the PHP issue tracker.

c) super duper huge websites and web applications are being built with PHP

I don't consider myself a PHP developer, but the argument about it being useless in spite of all the evidence is just ridiculous.

Re: PHP: A fractal of bad design

#125
Erm... OK... use something else then.

Fortunately there are many options when it comes to web development. You don't like PHP? Avoid it! Do not use it! Use Ruby or something.

I used to get cranky about Facebook. Now I don't use at all.. what do I feel about Facebook now? Nothing. No point getting your pants in a twist about something that doesn't need to a part of your life.

Re: PHP: A fractal of bad design

#126

I had a one-to-one talk with Rasmus Lerdorf a few weeks ago. This is one of the few things he said: " I wrote PHP as a hammer to do my stuff. Around 1993, the only way to write web apps was by hacking C and Perl. This was extremely painful, and you would have to do the same thing over and over again. So I started writing a tool which would make my work easier. " " I never thought while writing PHP that someday millio…

Popularity doesn't determine how many design flaws exist in a language, merely how many people actually get screwed over by each of them. Python and Ruby aren't perfect, and they've had more than enough attention for the flaws to have been found. Even if every developer in the world migrated to one of those languages overnight (o happy day) that language would not suddenly become as profoundly inept as PHP.

Re: PHP: A fractal of bad design

#127

A nit: "Subclasses cannot override private methods. Subclass overrides of public methods can’t even see, let alone call, the superclass’s private methods. Problematic for, say, test mocks." IMHO you don't want private methods to be visible in subclasses, because this makes the fragile base class problem worse. If I'm a framework developer working on a UI library, I should be free to add private methods to my Button c…

I agree. Blaming PHP for copying Java is a little absurd.

Re: PHP: A fractal of bad design

#128

Little new functionality is implemented as new syntax; most of it is done with functions or things that look like functions. That's a problem? I think it's a problem if new functionality can't be implemented as part of a library. I think it's a problem if the best way of implementing new functionality is always to have new syntax.

There's surely some middle ground, here. PHP defines constants with a function, creates functions with a function, creates data structures with a thing that isn't actually a function but is inexplicably designed to sorta resemble a function. Only now are these basic value definitions getting dedicated syntax.

Re: PHP: A fractal of bad design

#129
post #119

Earlier quoted context omitted.

from * import

That's an additional magic incantation people have to learn to add to the start of every file. In PHP, that magic incantation is invisible because they never have to type it or even know that it exists.

I was kidding (and lost the final asterisk); I would lose a lot of faith in Python if that ever worked. :)

Maybe new devs should learn Perl, instead... http://search.cpan.org/~adamk/Acme-Everything-1.01/lib/Acme/...

Re: PHP: A fractal of bad design

#130
One of the main reasons why I am so scared to use Wordpress is PHP. The article does a good job explaining why security holes in applications built on PHP wouldn't be a surprise. The only alternative is to constantly upgrade to the latest version. Sometimes, that breaks things like plugins. That is too much overhead for a blog.
Post reply on HN