Live data from Hacker News

PHP: A fractal of bad design

me.veekun.com

501–510 of 514 posts

Re: PHP: A fractal of bad design

#501
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".

Less people should have access to computer, it will make those who does more competent at programming.

Re: PHP: A fractal of bad design

#502

Earlier quoted context omitted.

PHP doesn't really have any strengths any more. The last one was ease of use and setup, but nginx and FastCGI seem to have beaten that too. The only things keeping it around as far as I can see are: * the huge lock-in with existing code + knowledge * network effects (aka. "Facebook and my mate Ken use PHP, therefore it must be good") * Most PHP devs don't know/want to know anything else. Like the post above says, lea…

First, do not assume that I only know PHP. I enjoy Python, and in fact, Erlang as well. =) Erlang is an especially nefarious little devil in that it almost makes me giddy with how it forces you to think. I'll make the assumption you weren't talking to me, but rather, the general audience instead. > Like the post above says, learn anything other than PHP. Python is an excellent language to learn! I agree. However, peo…

I see your point, but it's the same point that every other pro-PHP person has made. PHP lets you get stuff done fast... but in a few weeks (or even days depending on the person) Python and Ruby will have overtaken you, because all of the tutorials out there teach you to build a giant pile of insecure spaghetti hacks.

PHP is a terrible language for a beginner to learn, because there's no rhyme or reason to most of the things that it does. Which leads to cargo cult programming and bad habits that take a long time to break.

Re: PHP: A fractal of bad design

#503

Earlier quoted context omitted.

Again, Python et al have not evolved. They have continued to be modified and refined by the deliberate application of thought, particularly the kind of insightful, discursive thought that programming language design calls for.

The point is, Python wasn't (and perhaps isn't) perfect. Mistakes were made. Fixes introduced. PHP continues to be modified and refined as well. PHP developers are hard working developers with a difficult job; I can't help but think you're being insulting to them.

The difference is that at each stage, Python's designers have exercised more global reasoning than PHP's.

The PHP bar for inclusion, for most of its life, seems to have been "it compiles".

I don't think it's possible to directly compare PHP and Python and not draw the conclusion that PHP was basically slapped together out of any old thing that came to hand without any degree of planning or foresight.

Re: PHP: A fractal of bad design

#504

Earlier quoted context omitted.

The point is, Python wasn't (and perhaps isn't) perfect. Mistakes were made. Fixes introduced. PHP continues to be modified and refined as well. PHP developers are hard working developers with a difficult job; I can't help but think you're being insulting to them.

The difference is that at each stage, Python's designers have exercised more global reasoning than PHP's. The PHP bar for inclusion, for most of its life, seems to have been "it compiles". I don't think it's possible to directly compare PHP and Python and not draw the conclusion that PHP was basically slapped together out of any old thing that came to hand without any degree of planning or foresight.

The problem is that many early design decisions were made when PHP was a small personal project with the goal of accomplishing something immediately. It wasn't intended to be object-oriented. But that was a long time ago. Many of the points made about PHP design are ancient decisions and difficult to change because of backwards compatibility.

I'd say it's entirely unfair and incorrect to say the bar for inclusion has been "it compiles". Even some of the decisions made for PHP4, which I disagreed with, were debated endlessly.

Take, for example, the introduction of namespaces into PHP -- it got a lot of flack for using an additional character but if you study the design carefully it's nearly impossible for it work any other way in PHP. You might look at that and say there was no planning or foresight (or that it was simply the easiest solution) but that betrays the truth.

Re: PHP: A fractal of bad design

#505

Earlier quoted context omitted.

First, do not assume that I only know PHP. I enjoy Python, and in fact, Erlang as well. =) Erlang is an especially nefarious little devil in that it almost makes me giddy with how it forces you to think. I'll make the assumption you weren't talking to me, but rather, the general audience instead. > Like the post above says, learn anything other than PHP. Python is an excellent language to learn! I agree. However, peo…

I see your point, but it's the same point that every other pro-PHP person has made. PHP lets you get stuff done fast... but in a few weeks (or even days depending on the person) Python and Ruby will have overtaken you, because all of the tutorials out there teach you to build a giant pile of insecure spaghetti hacks. PHP is a terrible language for a beginner to learn, because there's no rhyme or reason to most of the…

I don't think you do. Are you really saying that introduction to python should be about REPL and basic syntax, and not accomplish an actual goal?

> because all of the tutorials out there teach you to build a giant pile of insecure spaghetti hacks.

I think this says it all. You really aren't interested in changing anything, just bad mouthing everyone and anyone that will listen. This entire time I've tried to have an honest conversation with you, and at each point, you've done your very best to dismiss what I've said and insult as many people as possible.

I'm sorry, I don't work with your type. Good day.

Re: PHP: A fractal of bad design

#506
post #75

Earlier quoted context omitted.

You can blame Larry Wall (Perl) for that one. It's amazingly powerful but also the stuff of nightmares in the wrong hands.

Nope. This works as you'd expect in Perl: the replacement is treated as code and executed like an inline function, never eval'd.

Yep, that's why s///ee exists :)

http://perldoc.perl.org/perlop.html#s/PATTERN/REPLACEMENT/ms...

"e Evaluate the right side as an expression.

ee Evaluate the right side as a string then eval the result."

Re: PHP: A fractal of bad design

#507

Earlier quoted context omitted.

I see your point, but it's the same point that every other pro-PHP person has made. PHP lets you get stuff done fast... but in a few weeks (or even days depending on the person) Python and Ruby will have overtaken you, because all of the tutorials out there teach you to build a giant pile of insecure spaghetti hacks. PHP is a terrible language for a beginner to learn, because there's no rhyme or reason to most of the…

I don't think you do. Are you really saying that introduction to python should be about REPL and basic syntax, and not accomplish an actual goal? > because all of the tutorials out there teach you to build a giant pile of insecure spaghetti hacks. I think this says it all. You really aren't interested in changing anything, just bad mouthing everyone and anyone that will listen. This entire time I've tried to have an…

You're making a lot of assumptions about what I am and am not saying. Check my profile if you want to see how I think Python should be introduced (hint: by doing actual stuff).

TL;DR: Beyond the very basics, PHP is only going to frustrate beginners. It has confusing syntax and weird special cases. You should pick something different as a first language.

Re: PHP: A fractal of bad design

#508
post #415
post #401

Earlier quoted context omitted.

The thing is we need to stop advising people to use it in the first place. That's what we're advocating. That is, we're not telling people to stop after they've gone into McDonalds, we're decrying the fact that so-called health experts are telling people that McDonalds is actually just fine for you. That's a better analogy.

> The thing is we need to stop advising people to use it in the first place. That's what we're advocating. Who are you to advocate that? Or to advocate anything? I despise people who presume to know what's in the best interest of others. You only know what's in your best interest. You have no idea what is good for anyone else. You want to share your experience? Great. Do it when it's asked for. Nobody asked for a hit…

"Exactly which maven and luminary of computer science has advocated the use of PHP?"

I didn't say that they were luminaries per se. Programmers telling non-programmers that PHP is OK for them is what I'm referring to. That would match the analogy--someone who's studying health science telling someone who hasn't studied health science that McDonalds is perfectly healthy.

Programmers need to stop telling non-programmers that it's perfectly OK to use PHP. Frankly, they need to be blunt that programming is hard. That you either have to willing to put in the investment or don't do it at all. This soft runway into developing applications is exactly the reason why so much poor software exists in the common market.

Re: PHP: A fractal of bad design

#509
post #433
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…

Plus if you to take a step back, and look at the fundamentals of PHP: * PHP is open source. If you don't like it, change it. Or submit patches. Or bug reports * PHP does what is says on the can. It's a hypertext preprocessor, and it does this exceedingly well * If you're having difficulty doing complex work in PHP, you're using it for the wrong problem The anti-PHP stance on HN is almost meme like. The lack of silly…

Part of the objection raised here is that the php maintainers are not amenable to fixing these problems with the language. Maintaining a private fork of the language with different semantics is both a recipe for disaster and at best a local solution.

Bug reports have been filed and closed for many of these issues.

A full on fork of php might be interesting, though the thought of what's going on behind the scenes in the php interpreter terrifies me.

Re: PHP: A fractal of bad design

#510
post #462

Earlier quoted context omitted.

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

> I've written PHP for about 3 years and I've never once used the @ to suppress errors. Is it so wrong to use @? I've always used (@$_REQUEST['foo'] === 'bar') as a shorter way of writing (isset($_REQUEST['foo']) && $_REQUEST['foo'] === 'bar') - I'm curious if there's a problem with that approach.

You be using array_key_exists instead.
Post reply on HN