Live data from Hacker News

PHP: A fractal of bad design

me.veekun.com

411–420 of 514 posts

Re: PHP: A fractal of bad design

#411
Everyone is certainly entitled to their opinions, but I'm puzzled as to whether some of the people claiming that PHP's greatest strength is its deployment model have had significant PHP experience?

As with most things, it's both good and bad. It IS fantastic that you can so easily toss a .php file into a directory, make a few minor Apache config adjustments, and BAM - dynamic website behavior.

...that's also a glaring weakness, though, when a complex application is developed without the structure imposed by other tools. I have to maintain an event registration system written in PHP, and I'm having incredible difficulty with it. The logic to store form data, look for errors, display the current form, and prepare the form for submission are all in a single, 1000+ lines spaghetti-code file.

I think the author's point (and certainly the one I'm making) is not that this is the only possible outcome of writing in PHP, or that other languages do not have this problem. Rather, the point is that the lack of cohesive structure removes barriers to writing bad code; in fact, it makes it (initially) easier than writing good code.

Re: PHP: A fractal of bad design

#412
post #218

Earlier quoted context omitted.

JavaScript has its bad parts, but it's nowhere near as bad as PHP in its bad parts. JavaScript has some really good ideas in it as well. Plus, it's actually quite easy to code in JavaScript avoiding the bad parts.

>JavaScript has its bad parts, but it's nowhere near as bad as PHP in its bad parts. I am not familiar with any precise quantification of the bad parts of JavaScript and PHP which could serve as a basis of that conclusion. That said, both PHP and JavaScript are web scripting languages that are full of bad parts. Extrapolating outwards, the entirety of modern web development is flawed. > Plus, it's actually quite easy…

This is also part of the problem. Go read Crockford's "Javascript: The Good Parts". Then notice that this article demonstrates why there is not, and probably never will be, "PHP: The Good Parts."

Re: PHP: A fractal of bad design

#413
post #19

"(And strictly speaking, Facebook isn’t written in PHP; it’s written in a C++ macro language with a striking resemblance.)" I'm a Facebook engineer who works on the HipHop compiler and HipHop virtual machine. It's in PHP, absolutely full stop. It's amazing how much the fact that g++ is involved somewhere in the toolchain confuses people in this matter. C++ is just an intermediate representation; the source language r…

I seem to remember reading that Facebook was using XHP, which allowed XML literals. That would certainly be an improvement over "warts-and-all PHP", in my opinion.

Of course, I'll trust what an actual engineer from Facebook is saying over some article that I can't even cite. Is this not the case?

Re: PHP: A fractal of bad design

#414
post #406

Earlier quoted context omitted.

> A few things I listed because they're weird, not outright wrong, and I stand by those. But a few things are weird to you but not some objective view of weird. Many of your points I didn't comment on are not unique to PHP at all (such as octal numbers) > For the most part you've defended PHP's behavior as design decisions or offered workarounds. You could say that unifying PHP error codes and exceptions is a "workar…

Let me put it this way: Lisp hackers think that one of the major problems with Emacs Lisp is that it basically uses one big namespace for everything, forcing awkward naming conventions and contortions to avoid collisions. That is possibly the one part of any Lisp that works like PHP ... and the Lisp community pretty much universally agrees that it's a bad idea, not because it's like PHP, but because it's a bad idea.…

Of course one big namespace is a bad idea and everybody knows it. I'm not sure why that's relevant here. Namespaces was always the #1 requested feature for PHP.

PHP does things differently; you don't import things before you use them -- PHP loads modules/classes as necessary when they're used. If you don't use a class, it's not loaded.

Other features of PHP make things like "import *" impossible (or at least very expensive) but at the same time it's also much less necessary.

Re: PHP: A fractal of bad design

#415
post #401
post #346

Earlier quoted context omitted.

You don't like it? Don't use it. You're the kind of asshole that'll walk up to somebody in McDonalds and tell them that the food they're eating isn't healthy. You know what? Mind your own business.

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 piece on PHP.

> we're decrying the fact that so-called health experts are telling people that McDonalds is actually just fine for you.

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

That is outright nonsense. At no point has that happened. PHP grew organically, without a single endorsement.

Re: PHP: A fractal of bad design

#416
post #409
post #254

Wow, this article is unnecessarily harsh. You get the feeling that one of his immediate relatives was crushed in a freak industrial machine accident and that he later found out that the machine was programmed in PHP. I work with PHP everyday, and it's a fine tool. It does what I ask of it, at least. If the objective is to drive a nail into a board, you can do it with a hammer or a rock, and it doesn't really matter w…

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…

[deleted]

Re: PHP: A fractal of bad design

#417
post #409
post #254

Wow, this article is unnecessarily harsh. You get the feeling that one of his immediate relatives was crushed in a freak industrial machine accident and that he later found out that the machine was programmed in PHP. I work with PHP everyday, and it's a fine tool. It does what I ask of it, at least. If the objective is to drive a nail into a board, you can do it with a hammer or a rock, and it doesn't really matter w…

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 language, of course, it's not compiled, but it has a lot of great features. A lot of the points made in the article I consider features of PHP and are not detrimental.

Re: PHP: A fractal of bad design

#418
post #19

"(And strictly speaking, Facebook isn’t written in PHP; it’s written in a C++ macro language with a striking resemblance.)" I'm a Facebook engineer who works on the HipHop compiler and HipHop virtual machine. It's in PHP, absolutely full stop. It's amazing how much the fact that g++ is involved somewhere in the toolchain confuses people in this matter. C++ is just an intermediate representation; the source language r…

I seem to remember reading that Facebook was using XHP, which allowed XML literals. That would certainly be an improvement over "warts-and-all PHP", in my opinion. Of course, I'll trust what an actual engineer from Facebook is saying over some article that I can't even cite. Is this not the case?

XHP is orthogonal to HipHop, since XHP is available as a module for Zend PHP - https://github.com/facebook/xhp.

Re: PHP: A fractal of bad design

#419

Earlier quoted context omitted.

My boss is. Forcing me, that is. I don't really have a choice. I can't afford to move (no, seriously, I can't), and there is no other work that I'm able to do. I dislike PHP. I wish my boss would let me explore alternatives. :(

>and there is no other work that I'm able to do. No offense, but you should really find the time to learn. That's not a hit against PHP (which I don't care much about one way or another; anything good enough for Facebook but full of such a large number of gotchas can obviously be read either way) and it's not even a comment about the marketability of your particular skill set. Instead, it's just intended as a friendl…

Hm. I think my choice of words weren't adequate to describe my situation.

It's not that I don't know how to do other things. It's that the things that I'm capable of doing put me in a narrow niche. With a long-standing back injury and medical problems resulting from exposure to chemical allergens, there's very little work I can do in the light industrial sector.

I have training as a carpenter (and I can do everything from foundation and framing to roofing and finishing - I have the training), but I'm no longer physically able to do it.

The list of programming environments I'm comfortable in is quite long, too. It's just that my choices are PHP, C#, and Ruby. And the PHP guys are the only ones hiring. I really should move to Seattle or something, but the cost of just getting there is a little over what I can do.

Re: PHP: A fractal of bad design

#420
post #25

Earlier quoted context omitted.

My boss is. Forcing me, that is. I don't really have a choice. I can't afford to move (no, seriously, I can't), and there is no other work that I'm able to do. I dislike PHP. I wish my boss would let me explore alternatives. :(

You may be able to do some fancy (i.e. useful and profitable) stuff in another language and show it to your boss. Maybe do this in your spare time while learning another language for fun. It may impress them!

No, that's why he hired me in the first place. He knows I can do all this fancy stuff.

He just won't let me.

Post reply on HN