Live data from Hacker News

Coding Horror: The PHP Singularity

codinghorror.com

311–320 of 341 posts

Re: Coding Horror: The PHP Singularity

#311

Earlier quoted context omitted.

> You're measuring the success of a website in terms of traffic. Yes, me and all Analytics and SEO guys. You either sell ads or stuff. In both cases you want as many eyeballs and wallets as possible. > The number of hits a website receives isn't the product of the language it's written in, but primarily a function of its marketing (and other factors that appeal to its users). There are also more websites with their f…

> You're measuring the success of a website in terms of traffic. I wasn't disagreeing, and in fact I didn't even express an opinion regarding this. Success means a lot of different things to people; I was stating your definition of success for clarity. The user doesn't care whether I write a website's back end in PHP, Ruby, Python, Haskell, C++, Ada, Clojure, or even Erlang. The success depends on how useful the site…

>I wasn't disagreeing, and in fact I didn't even express an opinion regarding this. Success means a lot of different things to people; I was stating your definition of success for clarity.

Oh, alright. Thought you meant it was not a good metric.

>The user doesn't care whether I write a website's back end in PHP, Ruby, Python, Haskell, C++, Ada, Clojure, or even Erlang. The success depends on how useful the site is and how well it's marketed. This isn't circular reasoning. There are more websites written in PHP because PHP is an easy language for beginners and therefore more common compared to Ruby or Python, for example.

Yes, that second argument is not circular reasoning because it searches for the causes.

But the argument in your previous post, I read it as: "PHP is used by more of the popular sites because PHP is used by more sites in general" Which is kinda circular, mostly repeating "PHP is popular".

>It's an absolutely untenable position to assert that the programming language itself affects how much traffic an site receives, which is what you originally defined as "success".

I did the opposite: the success of the site affects the programming language.

That is, I am a pragmatist: I see every successful site built with a programming language as one more verification that said language is good for building sites with (whatever the reasons).

If we have 200,000 high volume sites in PHP and 0 in X, as a pragmatist, I will avoid using X in my next high volume site project.

Working from that, one can also see why it is so. For example:

1) it's because X is obscure, so I wouldn't be able to get a team easily. Perhaps even no one in my city, at least without adding the overhead of teaching them X first.

2) it's because X is more expensive to host. I'll need to get a VPS whereas I can just put PHP on a $10/year server.

3) it's because PHP has more libs and stuff. This DB/service API/etc I want to use does not have X drivers (or has a semi-abandoned project).

4) it's because PHP has Drupal/Wordpress and I can have a high traffic portal/news style site in minutes, whereas X has only ho-hum solutions for that, or I would have to build one from scratch.

and so on.

Surprisingly, many so called "scientists" and "engineers" choose to argue from first principles. "X is a bona fide academic language, and has all those meta programming features, higher-order types and such, so you are crazy to use PHP over X for your project".

So, instead of reading the situation pragmatically, and finding the real pain points PHP eases and why it's used, they resort to idealistic rants about how masses are ignorant, "beating the averages", etc etc.

Well, this Zuckerberg guy, with his average PHP, beat Viaweb's Lisp by about 100x better valuation. If, according to "beating the averages", ViaWeb's success was a pro-Lisp point, why isn't that a pro-PHP point? Or does it only work when Lisp wins (as in, "ViaWeb won because of Lisp but Facebook won despite of PHP"). Talk about having it both ways!

Re: Coding Horror: The PHP Singularity

#312
post #295
post #279

Earlier quoted context omitted.

I stopped reading the blog article when I read the complaints around "private" and "static". The behavior is exactly what they were intended to. If he doesn't want that, he shouldn't use them. It also implies that he doesn't have much experience with languages like C#, Java or C++. Otherwise he would have learned this already.

Or I think they're misfeatures everywhere.

Then you should have mentioned it. From the article it seems that you are talking specifically about PHP, when in reality that argument can be applied to many.

I can only make my assumptions based on what I read. The lack of references to other languages makes me doubt your experience, and that is essential when you criticize something.

PHP has flaws and you have some valid points, but when you mention things that are either not specific to PHP or not a problem for me it makes me more skeptical.

Re: Coding Horror: The PHP Singularity

#313
post #307

Earlier quoted context omitted.

Note the use of the word "major"

Note the use of "true" in "no true Scotsman".

Note that I specifically wrote >1m visits per day.

Note also that the mention of one site is too literal and meaningless interpretation of my question, which is more rhetorical, and should be read like: "There are TONS of high volume PHP sites and very very very few high volume Lisp sites".

That said: the "no true Scotsman" logical fallacy is only a fallacy half of the time, like most of those so-called logical fallacies.

They assume a perfectly logical world, where you have infinite information at your disposal and infinite time to check it. E.g I'd rather listen to my doctor on my medical condition over a random guy on the subway, even if that's "appeal to authority".

Similar cracks in the "no true Scotsman" fallacy. There ARE cases where a category/taxonomy is used badly, and no true member of said taxonomy would so something. That is, membership in a taxonomy is not always 100% solid, and you can have true and less true (fuzzy) membership.

E.g

- No KKK member would attend a NWA concert. - But I just saw a KKK member rocking it at a NWA concert. - Well, no _TRUE KKK member_ would ever attend one.

It's obvious that the first guy is correct: no TRUE KKK would ever attend a NWA concert.

Now, a random KKK member could possibly attend one (say, out of curiosity). The "no TRUE" argument in this case, says not so much the impossibility of an event happening, but that it is against the very concept of the taxonomy under discussion for it to happen.

Hackers shouldn't touch the "logical fallacy" stuff with a ten foot pole. They presuppose that conversations and argumentation can just go "by numbers", without examining each individual case.

Re: Coding Horror: The PHP Singularity

#314
post #48

I seriously groaned when I saw this post (title). I was expecting an elitist diatribe about PHP (because this is perennially popular amongst particular programmers) but that's not what this post is intended to be. Interestingly Jeff does take the usual potshots at PHP almost like he thinks he'll lose street cred if he doesn't but the basic message I agree with: if you want someone to stop doing something you consider…

I can add to this list:

5. The set of functions for a gazillion useful everyday things that don't come standard in other languages. Where else would you find functions like htmlentities(), strip_tags(), mysql_real_escape_string()? I like list comprehensions - Python can be very concise - but PHP isn't exactly verbose:

Compare, reading a web page:

http://rosettacode.org/wiki/HTTP#PHP

http://rosettacode.org/wiki/HTTP#Python

http://rosettacode.org/wiki/HTTP#Java

Sending an email:

http://rosettacode.org/wiki/Send_email#PHP

http://rosettacode.org/wiki/Send_email#Python

http://rosettacode.org/wiki/Send_email#Java

6. Navigating or searching the online documentation is lightning quick. You don't have to know the names of functions or variables, you'll find them. The examples are like mini tutorials.

7. The write-test turnaround is lightning fast. There's probably not a small group of languages in this group, but you will really notice this if you come from say, JEE.

You need (need!) a language that's fun to use (that's fun for you to use), day in day out, not verbose, nor loaded with layers of frameworks. PHP is simple, direct, and I haven't been bitten by problems that in other languages have taken days to work out... or have never been worked out.

Honestly, I have never been bothered by the humungous list of "issues" in the link at the top of Jeff Atwood's post.

BTW, === exists explicitly to test type equality first, that's the point.

Re: Coding Horror: The PHP Singularity

#315
post #114

Earlier quoted context omitted.

If I make a string: ' ' . $var . ' ' - does it know to encode the variable, and not the entire string? What if I assign that string in a variable, and then output it later? I'm not convinced this can be done well. Maybe if all you do is make some templates and fill them in you could do it. But I do a lot more than that, I output dynamically built html all the time. Just give people a very easy and shortly named funct…

Perhaps what we need is a language/platform that has built in strings that track not just the code page type encoding, but some kind of "intent assertion" as well -- is the string intended to be encoded for a particular output? Combining an "unknown" string with an HTML (or SQL, or PostScript, or JSON/JavaScript, ...) string would produce an exception. Such a mechanism would have to include encoding functions (and as…

This problem has already been solved in the Haskell ecosystem [1]. For example, you get typesafe URLs so that if you have a standard query like myapp.com/person/345 you can't mistakenly misuse 345 as an article id. Every input string is tracked by the type system so the possibility for escape issues, injection attacks or cross site scripting exploits to sneak in is minimal. Static types also make sure that internal links can not be broken - if for example you decide to change the above URL to myapp.com/getperson instead, your application won't compile until you've fixed every other part that still references the old link .../person, and so on.

Not to mention the (also type safe) dead easy to use persistence framework.

I'm still in the process of evaluating different solutions for my next web project but so far I'm pretty sure this is gonna be my go-to framework in the future.

[1] http://www.yesodweb.com

Re: Coding Horror: The PHP Singularity

#316

Earlier quoted context omitted.

> You're measuring the success of a website in terms of traffic. I wasn't disagreeing, and in fact I didn't even express an opinion regarding this. Success means a lot of different things to people; I was stating your definition of success for clarity. The user doesn't care whether I write a website's back end in PHP, Ruby, Python, Haskell, C++, Ada, Clojure, or even Erlang. The success depends on how useful the site…

> I wasn't disagreeing, and in fact I didn't even express an opinion regarding this. Success means a lot of different things to people; I was stating your definition of success for clarity. Oh, alright. Thought you meant it was not a good metric. > The user doesn't care whether I write a website's back end in PHP, Ruby, Python, Haskell, C++, Ada, Clojure, or even Erlang. The success depends on how useful the site is…

> But the argument in your previous post, I read it as: "PHP is used by more of the popular sites because PHP is used by more sites in general" Which is kinda circular, mostly repeating "PHP is popular".

You misread what I wrote in that case. I said "There are also more websites with their foundations in PHP, so it's reasonable to expect a higher number of successes." This isn't circular reasoning, and let me show you why:

Lets pretend I'm superhuman and create 10,100 unique, high quality websites in one day. Let's assume also that my skill and experience remains constant throughout building these 10,100 websites; I'll get no better at marketing, design, etc and all my decisions are of equal quality. The only difference is the programming language I use to develop some of the sites.

For the sake of this example, let's assume that 1% of websites created, on average, end up with one million page views per month after six months.

In this fictitious example, let's say that for grins I build 100 sites in Lisp and 10,000 sites in Perl. 1% of my Lisp sites will be successful (a grand total of one successful site) and 1% of my Perl sites will be successful (100). From this data you're erroneously concluding that Perl is more likely to result in a successful site. This is wrong, because the number of sites created in each language varies wildly, but the odds of hitting "traffic gold" are still 1% with everything else being equal. The language, therefore, doesn't impact success rate.

Seeing something built in PHP doesn't make it a good choice, just a common one, just like smoking in the 1970s was a common choice, just not a good one.

Facebook, while it's mostly written in PHP, is actually transcompiled to C++ (HipHop compiler) because PHP was insufficient. They're not actually running any PHP code in production. Also I keep hearing that their codebase is an unholy mess and that the only reason it hasn't been re-written in another language is that the codebase is just now too big to rewrite. Zuckerberg wrote Facebook in PHP because it was the language he knew, not because it was the best tool for the job. Marketing and user experience made the site successful, not the language.

Don't just look at PHP and say "huh, it's common!" and conclude it's good. It just doesn't make sense and it's a logical error to do so.

Re: Coding Horror: The PHP Singularity

#317
post #251

Earlier quoted context omitted.

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…

Okay, I think I see how this worked out. Terms like "bigoted rant" and "fucking childishness" always give me the distinct impression the poster isn't interested in reasonable discussion -- particularly on HN, given the usual monocles-and-earl-grey manner of conversations here. In my experience, that sort of language only irritates whoever may disagree, and so lowers the level of debate, while achieving nothing of val…

It's a shame you are suffering from what I can only assume are poor PHP code bases. This is unfortunately very common with PHP because of it's popularity.

I've dealt with my fair share of poor PHP code bases, and have experienced PHP mature over the years into a very capable language; so know how to wield it to the best of it's abilities. If you ever need any advice feel free to email me.

Re: Coding Horror: The PHP Singularity

#318
post #101
post #83

Earlier quoted context omitted.

Congratulations! You just Blub Paradox'd yourself. At this point in your knowledge cycle, you are unable to understand something more complex than what you already know. Knowledge is power. Defending your own knowledge by refusing to expand and learn something new is cutting yourself off at the knees (or fingers, as it may be).

I'm sorry, but at what point did I say I was refusing to "expand and learn something new"?

The subtext of your challenge is that no language could possibly exist that is substantially better than PHP at expressing a solution to any problem, which would mean there's little to be gained by learning anything else. That's not a claim I'd ever make about my favorite languages, even though nobody makes huge lists of indefensible design gaffes in those.

Re: Coding Horror: The PHP Singularity

#319
post #136
post #83

Earlier quoted context omitted.

Congratulations! You just Blub Paradox'd yourself. At this point in your knowledge cycle, you are unable to understand something more complex than what you already know. Knowledge is power. Defending your own knowledge by refusing to expand and learn something new is cutting yourself off at the knees (or fingers, as it may be).

Have you done any Agda, recently?

I for one will freely admit that my Haskell still sucks and so I presume I'm not even smart enough yet to start on Agda. Do you recommend it? Do you find it to be (one of) the highest known point on the power continuum?

Re: Coding Horror: The PHP Singularity

#320

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.

Amazon.com was famously put together by mostly Lisp engineers. They more recently switched to C++ and apparently experienced a lot of growing pains as they had to learn how to scale up C++ to match what they had been doing in Lisp for years.
Post reply on HN