Live data from Hacker News

PHP: A fractal of bad design

me.veekun.com

441–450 of 514 posts

Re: PHP: A fractal of bad design

#441
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…

I 'm glad this got topvoted.

PHP is the MS Word of web programming. It will be here for a long time, just get over yourselves and concentrate on what you write, not how you write it.

Re: PHP: A fractal of bad design

#442
post #432
post #365

Earlier quoted context omitted.

And again you make the same mistake. You take one solution, you say it doesn't work like your favorite solution (while obviously all proper solutions should be done exactly like the one you prefer, since there's only one right way to do anything and it's, not surprisingly, exactly the way you prefer) and you make it the fault of the language used for it's implementation. How that even makes sense? I write code in a n…

> How that even makes sense? Maybe my point wasn't clear. It's not a difference in how those two ORMs accomplish their goal; it's that PHP doesn't let you do what SQLAlchemy does, even if you wanted to . Want to write an ORM that uses YAML, XML, or comment annotation in Python? Great! Want to write an ORM that uses classes or objects as column declaration in PHP? Too bad. > Rehashing old tired "strpos doesn't have un…

I have no idea what you mean by "what SQLAlchemy does" - I'm sure it does lots of things and most of these are perfectly doable in any language out there. You must be meaning some specific thing that is a favorite of yours - and indeed maybe it is hard to do it in PHP (or maybe not - since you didn't tell what this thing is nobody can have any idea). Who cares? I can name a bunch of things that is harder to do in Python that in some other language, but I don't run around shouting "Python sucks".

> Now I think you're just being petty. Obviously an underscore isn't what we're talking about here. Take your straw man elsewhere, please.

What he's talking about here is known and talked about for 10 years. It's just function names, it's not that big a problem. Yes, we know old function names are inconsistent. No, we can't change them because that will break code. If that's what makes or breaks language for you, PHP is not for you, and most languages are not for you, because you're obviously not interesting in solving the problem, you're interesting in boosting your self-esteem by boasting shiniest tool out there. Nothing wrong with it, but PHP is not created for that. If that means for you that PHP sucks, fine, but for 99.99% out there shininess is very low on the list of priorities. So if you want to discuss important stuff, leave old stale stuff like ranting about strpos alone and discuss important stuff.

Re: PHP: A fractal of bad design

#443
post #365

Earlier quoted context omitted.

And again you make the same mistake. You take one solution, you say it doesn't work like your favorite solution (while obviously all proper solutions should be done exactly like the one you prefer, since there's only one right way to do anything and it's, not surprisingly, exactly the way you prefer) and you make it the fault of the language used for it's implementation. How that even makes sense? I write code in a n…

Then again, why can't the author not post it on HIS blog? No less. Any old tired issues for you could be something new for someone else.

That's fine, anybody is free to rant on his blog. That's just a rant and not some revelation about something significant about PHP.

Re: PHP: A fractal of bad design

#444
My 5cents on that (recently published issues):

(see https://bugs.php.net/bug.php?id=54547)

or

built-in PHP web server dies with a large Content-Length header value: The value of the Content-Length header is passed directly to a pemalloc() call in sapi/cli/php_cli_server.c on line 1538. The inline function defined within Zend/zend_alloc.h for malloc() will fail, and will terminate the process with the error message "Out of memory". (see https://bugs.php.net/bug.php?id=61461)

Luckily we are getting Javascript ready to replace all PHP on the server sooner or later ;-)

Re: PHP: A fractal of bad design

#445
post #302

Earlier quoted context omitted.

"Name one. I can't think of any that aren't better served by other constructs." User input of code. It's hard to implement a REPL without it. Even if you do implement without it there's still an "exec" implementation hiding in there somewhere. Also, on rare occasions, it is actually an optimization when used carefully, like the Python nametuple example mentioned nearby. I'm just answering your challenge. I totally ag…

User input of code. I use this in my Python data processing scripts. That is, when I generate data, I generate it as Python literals, either lists or dictionaries. When I have to process it, minimal parsing needed, I just eval it into my code. def parse_and_append(line, seq, str): if str in line: seq.append(eval(line[line.find(str) + len(str):])) nums = [] mappings = {} for line in data_file: parse_and_append(line, n…

JSON will let you do that just as well. Or, if you must, there's ast.literal_eval which will only allow Python literals.

Re: PHP: A fractal of bad design

#446
post #236

Earlier quoted context omitted.

20-something centuries ago, without the benefit of calculus or Newtonian physics, Romans were better engineers than Rasmus Ledorf.

Survivors bias, I think. We just don't see all those buildings/bridges that collapsed. And they put bridge designers beneath the bridge when legion crossed it for the first time. If we started to do equivalent for programmers, we would have much better code quality :) And in regard to programming language design we don't have calculus, either. We're just experimenting, and trying to repeat what works.

> Survivors bias, I think

That's definitely part of it. But the Romans really did care about engineering and took it seriously -- one of the earliest writers on architecture was Vitruvius. What did he say about buildings?

That they should be safe, functional and attractive, in that order.

> And in regard to programming language design we don't have calculus, either.

Church and McCarthy would like a word ...

Re: PHP: A fractal of bad design

#447
post #445

Earlier quoted context omitted.

User input of code. I use this in my Python data processing scripts. That is, when I generate data, I generate it as Python literals, either lists or dictionaries. When I have to process it, minimal parsing needed, I just eval it into my code. def parse_and_append(line, seq, str): if str in line: seq.append(eval(line[line.find(str) + len(str):])) nums = [] mappings = {} for line in data_file: parse_and_append(line, n…

JSON will let you do that just as well. Or, if you must, there's ast.literal_eval which will only allow Python literals.

I see no reason to use JavaScript to process my data files - keep in mind this is data post-processing of experiments, not a user-facing application. And I enjoy Python, so I'll stick with it. But thanks for the pointer to literal_eval, I have not explored that part of the standard library.

Re: PHP: A fractal of bad design

#448
post #432
post #365

Earlier quoted context omitted.

And again you make the same mistake. You take one solution, you say it doesn't work like your favorite solution (while obviously all proper solutions should be done exactly like the one you prefer, since there's only one right way to do anything and it's, not surprisingly, exactly the way you prefer) and you make it the fault of the language used for it's implementation. How that even makes sense? I write code in a n…

> How that even makes sense? Maybe my point wasn't clear. It's not a difference in how those two ORMs accomplish their goal; it's that PHP doesn't let you do what SQLAlchemy does, even if you wanted to . Want to write an ORM that uses YAML, XML, or comment annotation in Python? Great! Want to write an ORM that uses classes or objects as column declaration in PHP? Too bad. > Rehashing old tired "strpos doesn't have un…

> Want to write an ORM that uses classes or objects as column declaration in PHP?

What prevents you from doing that in PHP?

Re: PHP: A fractal of bad design

#449
post #394
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…

> If you're not going to use it, why complain about it? I can tell you my reasons: the market. Not all of us can roll a globe, close our eyes, pinpoint a place and tomorrow have a job there. Here where I live, about 80% of webdev jobs are PHP. Even when I do manage to get a Ruby or a Python job, chances are that I will be doing lots of PHP code maintenance and migration anyway. I would like to change it, and I don't…

>> Here where I live, about 80% of webdev jobs are PHP.

I'm getting the impression that this is why a lot of people hate PHP - Money. People don't like that the market is full of money wasted on an inferior language. Perhaps there's a bit of envy in that, perhaps not.

The winners in the marketplace aren't always the best, and it's not easy to change minds. People get religious about the things that make their living, whether it be a programming language, certification/designation or some other thing.

But Atheists aren't going to convert many Christians and Christians aren't going to convert many Scientologists.

In the end, you have to work within the parameters of the market or create your own. I guess for some people, like the OP, it's easier to vent. Nothing wrong with that - we should all speak our minds, but it's not necessarily going to be effective in converting anyone.

Look at the resulting discussion here, the OP's either preaching to the choir, or his message is falling on deaf ears. I don't see a lot of 'a-ha, he's right, I'm switching now' posts.

Re: PHP: A fractal of bad design

#450
post #440
post #398

Earlier quoted context omitted.

It's just that the people who disagree generally aren't really programmars, they're designers turned quasi-web-developers. The community does them a disservice by pointing them at a giant pile of crap and saying "Go use this. You'll be fine."

People who disagree are "programmars" just fine. They just know how to use proper tools for the job given, instead of ranting because they're too lazy to read the manual, like author of the post.

Did the author give you the impression that he was "too lazy to read the manual?" I got almost the exact opposite impression, that he had read the documentation to the point of exhaustion and found it severely lacking.
Post reply on HN