Live data from Hacker News

PHP: A fractal of bad design

me.veekun.com

231–240 of 514 posts

Re: PHP: A fractal of bad design

#231

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

English is not a computer language. Expressiveness is valued more than precision. What is the logical difference between "creeping" and "sneaking" and "slinking"? These words differ mainly in "flavor". Ask 10 English speakers to tell the difference and they won't agree. This is fine for poetry but very bad for programs. Ambiguity == bugs.

Re: PHP: A fractal of bad design

#232
I know PHP is horrible, but I use it, and so do thousands of other people.

Until there is something else where you can deploy a prototype by dragging a single file onto a server with a FTP program, then PHP is serving a purpose that no other language can meet.

So stop crying about how PHP is horrible; stop trying to fix what is obviously a broken language; make something else that can fit this need, and you will kill PHP.

The only reason why still PHP exists past hobbyists is because people who start businesses want a fast prototype, cheap hosting, and no fuss. It may not be ideal, secure, fast, scalable, maintainable, or anything else, but if it's making money in the shortest amount of time possible, with the lowest cost barriers, then it's a success.

Re: PHP: A fractal of bad design

#233
post #13

Since my day job is PHP-centric and I was already aware that PHP is awful, this is theoretically helpful to me, but oh lord, it makes my liver hurt. If I could get away with it, I'd never again trust my credit card number to a system based on PHP, but I suspect that that's about as easy as never trusting your credit card to an ATM/point-of-sale machine based on Windows.

That PHP logo trick is going to make it easy to spot companies with a wobbly PHP stack. http://www.0php.com/php_easter_egg.php

Try it on Facebook; I guess that means HipHop must not be 100% real PHP. :-)

Re: PHP: A fractal of bad design

#234
post #116

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

What English is good at is expressing a huge variety of ideas. I once heard someone argue on NPR (sorry, no citation) that English is perhaps the /best/ language at expressing absolutely any idea to another person precisely because it has such a huge vocabulary and so many idiomatic phrases. I've sometimes heard of programming as an art, like poetry, but if so I'd prefer to maintain that it is a minimalist art that e…

> What English is good at is expressing a huge variety of ideas. I once heard someone argue on NPR (sorry, no citation) that English is perhaps the /best/ language at expressing absolutely any idea to another person precisely because it has such a huge vocabulary and so many idiomatic phrases.

And LISP is the best programming language there is, even if I don't know most of the other programming languages, because LISP has macros.

I highly doubt it anybody is qualified to make such statements, because you'd need to speak fluently every language there is, just to be sure. Seems like somebody just wanted to feel better because his language is the best.

Re: PHP: A fractal of bad design

#235
post #163

Earlier quoted context omitted.

> Operators are very fragile in the parser; foo()[0] and foo()->method() are both syntax errors. The former is allegedly fixed in PHP 5.4, but I can’t find mention of a fix for the latter. The latter doesn't need a fix because it always worked. Honestly, how hard is it to test that foo()->method() works? > == is useless. Actually, it's not useless. It does have a few stupid edge-cases and I will admit that. But in mo…

Only a couple of these things are outright wrong; I removed the offending bullet points earlier tonight. A few things I listed because they're weird, not outright wrong, and I stand by those. For the most part you've defended PHP's behavior as design decisions or offered workarounds. Workarounds just demonstrate that the language is Turing-complete. Design decisions are only okay if they actually make a useful tradeo…

>PHP doesn't need a module system? What? Once your program consists of more than two files, you're going to want to import stuff from one into the other in a structured manner.

PHP has a module system: Namespaces and the class autoloader.

Re: PHP: A fractal of bad design

#236

Earlier quoted context omitted.

Those bridges weren't continually "enhanced" by slapping on more stone and wood (at least not the ones that remained standing for long). Each bridge was a fresh design, based on the best practices of the day. Kind of like new programming languages.

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.

Re: PHP: A fractal of bad design

#237
post #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.

You should be scared to use Wordpress because it's Wordpress. I don't know a single experienced PHP developer that has a good word to say about Wordpress's code quality.

Re: PHP: A fractal of bad design

#238

I've been to some conference lately and next to me was a guy sitting excited about the high traffic system he's building—I asked about the language he is using: He (playing with his iPad 3): PHP Me: I thought PHP devs died out for years?? He (angry): PHP is still the most used language for the web and it's fast. Me: Do you guys still mix front-end and back-end code? He (still angry): Of course not. Back home I starte…

IMHO the only two PHP frameworks you need to care about are: Symfony2 (think a PHP equivalent to Django or Rails) and Silex (think a PHP equivalent to Sinatra).

I've just spent the weekend porting an old site to Silex and Twig (a PHP equivalent to HAML) and its been a breeze.

Both frameworks come from the same people and have excellent documentation and support (i.e. they are not run by a couple of geeks somewhere who might suddenly stop developing them once they get bored). See: http://symfony.com/elevator-pitches

Re: PHP: A fractal of bad design

#240
Developers really do complain a lot, don't they? PHP offers unparalleled flexibility if you have any notion whatsoever of how to properly develop things.

Those who think otherwise are most likely stalwart proponents of some other language, engulfed in functional programming or have read the latest post by _____ that explains a concept that should be used only rarely and will use it as an attack to state why another language is awful.

The fact is, you will never, ever, ever convince someone that your opinions are better than their own if they don't already think those things. Every language sucks and every language is awesome. Get over it. Bootstrap/CSS, HTML, jQuery and the database are easily 80% of the code of any generic site that isn't a business. The rest is Database access, AJAX functions, Auth, View rendering and hopefully security - and while important are very small in comparison to the grand scheme of things.

You don't need sockets. You don't need Duck typing. You don't need event-driven functionality to do most of the things you find on the internet. Those things are fun, but are not that important in the long run.

PHP is outdated, seemingly random and can let you write terrible code. It also does not get in your way if you are a competent developer and shortcomings are slowly being addressed, which is a good thing. When was the last time you wrote a site that NEEDED the things PHP is missing as a language?

Post reply on HN