Live data from Hacker News

PHP: A fractal of bad design

me.veekun.com

421–430 of 514 posts

Re: PHP: A fractal of bad design

#421
post #376

Earlier quoted context omitted.

Yes, that would be great. An alternative intro would be most welcome. It should, though: - Be able to start and serve in minutes, across most platforms - Allow for portable code e.g. the code you create locally should be able to be ported over to an actual webhost with only [S]FTP. - Not require the command line to "work". At all. I tried to learn django ~a year ago, and it was an experience wrought with frustration…

"The main trouble was getting all the packages/dependencies correct. " This is the one big problem python has; terrible package management. I can think of 3 different package management systems for python. All of them barley work and the various libraries all require different mangers and different python versions. This package requires python 2.6. This other package requires 2.5. And now we have separate python 3.x…

Well, to be fair, "package management" in PHP usually means bundling every single package you need with every single app that needs them. Then you upload the whole thing by FTP.

Re: PHP: A fractal of bad design

#422
post #365
post #355

Earlier quoted context omitted.

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

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.

Re: PHP: A fractal of bad design

#423
post #362

Earlier quoted context omitted.

> You've turned something that's a person's fault into something that's the language's fault. > You're taking a look at other people's code, and judging the language from it. At some point, you have to start blaming the language for fostering an environment where that code is acceptable.

You can write bad code in any language. It's the programmers responsibility to make sure the stuff they are writing is good and that only comes from experience with the language.

Of course you can. But is it always an equal share of bad code for each language? If not, then you have to admit that the language itself will encourage or discourage bad code or bad coders.

Re: PHP: A fractal of bad design

#424
post #337

Earlier quoted context omitted.

> If this one thing that annoys me on HN it's the pervasive anti-PHP snobbery. If there's one thing that annoys me on programmer forums in general, it's that pointing out PHP's giant flaws is conflated with snobbery. Design matters, and that is not the same thing as saying it's impossible to build anything good with PHP.

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?

I'd like to know how much of his massive complaint "don't really matter".

Programming language critic come up every now and then in HN, this is nothing new. If you got a point, why not refute it?

Are you saying language design don't matter and not worth discussing?

Re: PHP: A fractal of bad design

#425
post #298

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…

I agree with the general point but this seems more of an indictment of other languages than a plus for PHP: with PHP, it's easy to get started with the most simple features - and then it takes years to learn how to cope with the language quirks and inconsistencies, deal with outright bugs, and learn a number of non-obvious ways in which your “working” site might be hacked due to a hidden language feature. There are t…

Maybe I'm missing something in your comment here, but - Python and Ruby already have smooth dev server installs. In fact, much smoother than PHP, as you don't need apache or fancy permissions to just run something local.

Ruby, rails: "rails server" Ruby, sinatra: "ruby " Python, django: "python manage.py runserver"

All of these spin up an app server on some port > 1024. I'm honestly not sure how it can get much easier than that.

Re: PHP: A fractal of bad design

#426
post #88

Meh, I've written a lot of PHP code. I also work in Ruby and Python. All three have problems, but I like all three. With PHP, you have to develop a coding style that naturally avoids PHP's weird areas. It's not really that hard to avoid the mines, but you do have to be aware of them. In exchange, you get a scalable web server and a language that requires minimal babysitting. Instead of automatically throwing a 500 on…

Lets say for someone who is new to PHP, how long does it normally takes to learn where the minefields are? Is there anyway to start on this? I know in JS there is Javascript The Good Part. Is there anything equivalent in PHP?

Re: PHP: A fractal of bad design

#427
post #329
post #215

Earlier quoted context omitted.

I agree, but lets say your car breaks down somewhere in the middle of the road. Now you have two options. One is to learn the entirety of automobile engineering before touching your car, second is to learn enough fix the problem for the moment. Needless to say any normal person will prefer the second approach. Now some mechanical engineer may make an argument that this small quick fixes are harmful for long term mech…

While I'm sitting on the side of the road waiting for the PHP maintence truck to come and tow my car away -- I'll read a book... http://djangobook.com/

Don't, it's outdated and the official docs are just fine.

Re: PHP: A fractal of bad design

#428
post #417
post #409

Earlier quoted context omitted.

From the article: >Don’t comment with these things >>I’ve been in PHP arguments a lot. I hear a lot of very generic counter-arguments that are really only designed to halt the conversation immediately. Don’t pull these on me, please. :( >>>Do not tell me that “good developers can write good code in any language”, or bad developers blah blah. That doesn’t mean anything. A good carpenter can drive in a nail with either…

I did read it, that's why I used that concept. I don't think calling me a "jerkhole" really adds to the dialogue. I just disagree. The author points it out because he doesn't want to hear it. That doesn't make it a less correct counter-argument. I think accomplishing the goal is most important. Secondly, I don't think PHP is a bad tool. You can accomplish tasks very quickly in PHP. It is certainly not the fastest lan…

If you read that part, it certainly didn't inform what you wrote. You tapped out the same tired boilerplate argument as ever without actually saying why he was wrong to dismiss those arguments up front, or without even acknowledging that he did so. So your post was indistinguishable from what someone would say who hadn't read the article, and that's why I called you a jerkhole: I'm pointing out how you didn't add any signal to the conversation. If you'd been serious about adding signal instead of noise, you would have acknowledged that he anticipated your argument, and made a counterargument to his dismissal. You did not. You just said "no it's not, because I say so."

Re: PHP: A fractal of bad design

#429
post #88

Meh, I've written a lot of PHP code. I also work in Ruby and Python. All three have problems, but I like all three. With PHP, you have to develop a coding style that naturally avoids PHP's weird areas. It's not really that hard to avoid the mines, but you do have to be aware of them. In exchange, you get a scalable web server and a language that requires minimal babysitting. Instead of automatically throwing a 500 on…

Lets say for someone who is new to PHP, how long does it normally takes to learn where the minefields are? Is there anyway to start on this? I know in JS there is Javascript The Good Part. Is there anything equivalent in PHP?

Hm, not that I know of. The biggest thing is to read about PHP's security issues (especially how to avoid SQL injection attacks). After that, it's mostly writing code in it. If you start by writing PHP like you'd write C and then branch out, you can figure it out. Stay away from running anything shell related from your PHP code or anything that manipulates the file system unless you know what you're doing. If you're doing anything that's very critical to your users, I'd probably do it in a different language.

Re: PHP: A fractal of bad design

#430

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…

There is a quote from Bjarne Stroustrup saying along the same line...

“There are only two kinds of languages: the ones people complain about and the ones nobody uses.” ― Bjarne Stroustrup, The C++ Programming Language: Special Edition

Post reply on HN