Live data from Hacker News

Coding Horror: The PHP Singularity

codinghorror.com

251–260 of 341 posts

Re: Coding Horror: The PHP Singularity

#251
post #103

Earlier quoted context omitted.

Cool story, bro. Edit: OK, I'll bite. Um, so you're telling me, I lack self awareness because I said "fucking childishness" .. and that you understand me on some level because of it. You might want to get down of that high horse of yours.

So, you're calling people "childish", yet you 're the one tossing out coarse language, then dismissing people with trite memes like "cool story bro"? In a community that prides itself on its etiquette, meme-free nature, and other forms of maturity, no less? Yep, you lack self-awareness.

Back up there EvilTerran. Let's take a couple of steps back in this thread. I originally took issue with the OP because his piece was nothing short of a rant. I've spent the last 11+ years of my professional life developing with PHP. So I expect far more than what I read from someone like Jeff .. and was reasonable enough to let him challenge me to prove the errors of my way.

I also took issue because he didn't point out any actual problems or solutions .. rather he just blanketed PHP as a problem in and of itself and his solution was to replace it. This is not the kind of thing I'd expect from someone like Jeff who runs a site that points out in great detail programming flaws not just making hearsay.

Anyway, then you came along taking offence to my use of the f word. I'm sorry you take offence to harsh language but that's not my problem. Your first response to me added NOTHING to the conversation apart from your own very strange opinion of me because of two words I had said. I figured you where a troll so gave you the response I did. Then I thought hang on, let's check this guy out and see what we can glean from his past posts. You have been active for almost 100 days and your posts seem to point to you being a nice enough guy, so I figured you deserved more than my first general reply.

I also note that you just got your CS degree. Well done, and I hope you have a long fruitful career, I really do.

Re: Coding Horror: The PHP Singularity

#252
post #93

Earlier quoted context omitted.

The setup time issue is an advantage of PHP over many languages. But, I will let you in on a little secret, once you know how to do it 'setup' time is a drop in the bucket on all platforms. And in the rare case where it might otherwise be hard, people setup a shell environment they can use as the template on any project and it just works. That said, there are popular languages worse than PHP for most web development…

PHP will always have an edge. If you want to do something stupidly simple, no other language can match. Now that's horrible code, it has a dozen bugs aside from the security issues, but I would go so far as to say when I need to do something stupid like that quickly, nothing matches the simplicity of PHP. It's downright elegant. Not to say you should write a webapp in it, but I think you're wrong; there's intrinsic o…

  require 'net/http'
  puts Net::HTTP.get(URI.parse('http://news.ycombinator.com')).gsub('Hacker', 'Interwebz')
I'm confused. Where's the edge?

Or, even simpler,

  require 'open-uri'
  puts open('http://news.ycombinator.com').read.gsub('Hacker', 'Interwebz')

Re: Coding Horror: The PHP Singularity

#253
post #248
post #237

Earlier quoted context omitted.

The aspects of PHP that are bad (and there are more than a few) are easily tooled around. We have a review-time tool that parses your PHP, symbolically executes it, and looks for dubious idioms, flagging them for you and your reviewer. Meanwhile, PHP gets a number of things very right. For instance: * State: there is none across requests. Oh sure, there's APC, and the filesystem, and databases, etc., but those are al…

>These three things turn out to be among the most important parts of a server-side language So the language does two of these three things by not doing them at all ? State: oh there's no state across requests. Concurrency: No shared resources, no threads, but we'll call it shared-nothing concurrency and then say it looks like Erlang!! Amazing. An Erlang actor holds mutable state and sends immutable messages. A web re…

Nobody's asking you to like PHP. I'm explaining why it's effective; if you'd like to build something better, there are affirmative lessons to learn from PHP's undeniable successes. While your point about Erlang is correct for pure PHP, one of the nice things about the "curl as concurrency model" world is that the thing on the other end of the curl doesn't have to be PHP, or stateless.

Getting "hard problems" right by realizing they're intractable and refusing to solve them is a perfectly valid system design choice, even though it drives people up a wall when they first encounter it. For an example that has stood the test of time, check out UNIX's handling of the "PC-losering" problem: http://dreamsongs.com/WIB.html. When modern systems people read about this controversy, it seems kind of insane; of course system calls can be interrupted, and of course you don't want the OS to be magically trying to make them look transactional by backing up and restarting your system call when the world is really in an unknown and unknowable state. Ctl-C on a read() shouldn't restart the read(), unless the application thinks it should, and only the app really knows. EINTR was the non-solution that acknowledged the intractability of solution.

Historically, UNIX is a "worse-is-better" system not unlike PHP. I claim anyone designing a new system from scratch to replace it should learn from it, though, both mistakes and successes. PHP is not free of successes.

Re: Coding Horror: The PHP Singularity

#254

Earlier quoted context omitted.

Can you give an example?

Any major websites done on Lisp, Smalltalk or Haskell? Besides Viaweb? Now count > 1m visits per day websites done in PHP.

> Any major websites done on Lisp

Does Hacker News count?

Re: Coding Horror: The PHP Singularity

#255
post #56

Earlier quoted context omitted.

Why is python or ruby too hard for your dad to learn? If anything I would think something like ruby would be even easier than php since things are a bit more consistent. I just don't see how PHP is more approachable, especially compared to the supposed ease of ruby on rails.

Err, I love Rails and all, but don't confuse ease of use with ease of learning. The thing about putting convention over configuration is that you have to learn a lot of conventions.

Interestingly, this is the problem with non-alphabetic natural languages, too.

Re: Coding Horror: The PHP Singularity

#256
post #73

Ok, so here it goes. I haven't commented on this site for over a year. Full disclosure: I am an average programmer compared to many here. I come to this site to improve my self and read about what brilliant and amazing things you all do. Now you have a reference. I use PHP on a daily basis, have been for years. I am a freelance developer who has been able to carve out a living with a lot of hard work and a lot of luc…

What other languages besides PHP have you used? I think a lot of us dislike PHP because we're putting it in the context of better designed languages.

Sorry to respond twice to your post, but I realized this was a great opportunity to learn something. Given my basic example in my post, what language would you recommend I try to accomplish this task? I like to stay away from frameworks so basically I'm asking you to not suggest Rails, however don't be afraid to suggest ruby. If you feel like typing something out, let me know why you suggest it and what advantages it has over PHP.

Re: Coding Horror: The PHP Singularity

#257
post #256

Earlier quoted context omitted.

What other languages besides PHP have you used? I think a lot of us dislike PHP because we're putting it in the context of better designed languages.

Sorry to respond twice to your post, but I realized this was a great opportunity to learn something. Given my basic example in my post, what language would you recommend I try to accomplish this task? I like to stay away from frameworks so basically I'm asking you to not suggest Rails, however don't be afraid to suggest ruby. If you feel like typing something out, let me know why you suggest it and what advantages it…

Just try something. I don't doubt that PHP has its good points, but how can you appreciate them without having something to measure them against?

Ruby or Python would probably be the best choices if you don't have anything else in mind.

Re: Coding Horror: The PHP Singularity

#258

Earlier quoted context omitted.

I hear about them a lot. The difference is that PHP is so much worse. Yes, every language has warts. But PHP is the only popular language I know of which is essentially nothing but warts. Of course that's subjective, and people disagree, but there really does seem to be a real, qualitative difference between the warts on a mostly nice language like Python, and the ubiquitous bizarro world that makes up just about the…

> But PHP is the only popular language I know of which is essentially nothing but warts. This is entirely untrue. PHP isn't even a bad language on the scale of actual bad languages. It has some warts but they don't really impede the development of good software. There are many languages that make developing good software nearly impossible.

What other popular language is as bad? COBOL?

I don't know about impeding the development of good software. Warts can always be worked around as long as you know about them and how to handle them. But that doesn't mean they don't matter, and PHP has so many that it's difficult to enumerate them.

What other popular languages silently convert strings to floats and then do math or floating-point comparisons on them? What other popular languages have literally hundreds of failing unit tests in their mainline implementation, allowing ridiculous and insecure regressions that were actually caught by testing but never noticed to ship in an official release?

I doubt there's any one wart that's exclusive to PHP. What's remarkable about PHP is how it manages to gather so many in one place. Each one alone is not that bad, but the sheer number of them is astounding.

Re: Coding Horror: The PHP Singularity

#259
post #111

Earlier quoted context omitted.

> > default to HTML escaping on output > ??? Is that a joke? Don't do that! That's just as bad as magic quotes. No, it's not. Magic quotes are a pain to reverse. HTML escaping can be built into the echo/print/ commands, so that it is: - A setting that can be totally turned off at run-time, if you want; - Easily overridden on a case-by-case basis with a 'rawecho' function that does *not* escape anything.

I've seen too many multiply encoded things to be so sure this is a good idea. Plus too many cases of extra backslashes from back in the magic quotes days.

I've seen too many sites with XSS vulnerabilities to think it's a bad idea.

Negligence should result in mangled output, not a security problem.

Re: Coding Horror: The PHP Singularity

#260

Earlier quoted context omitted.

> But PHP is the only popular language I know of which is essentially nothing but warts. This is entirely untrue. PHP isn't even a bad language on the scale of actual bad languages. It has some warts but they don't really impede the development of good software. There are many languages that make developing good software nearly impossible.

What other popular language is as bad? COBOL? I don't know about impeding the development of good software. Warts can always be worked around as long as you know about them and how to handle them. But that doesn't mean they don't matter, and PHP has so many that it's difficult to enumerate them. What other popular languages silently convert strings to floats and then do math or floating-point comparisons on them? Wha…

> What other popular languages silently convert strings to floats and then do math or floating-point comparisons on them?

JavaScript. Most of the "issues" around comparisons/conversions/etc equally applies to JavaScript as it does to PHP.

But PHP does some very stupid casts but it's really just one problem. In the lists of "failures" tend to show that same problem 15 different ways to show how screwed up things are. If your code is well designed and secure you don't encounter these problems anyway.

> What other popular languages have literally hundreds of failing unit tests in their mainline implementation...

I'll give you that. Since that happened, the PHP developers have worked to ensure it won't happen in the future. No platform is free of particularly big security fails (Rails).

Post reply on HN