PHP: a fractal of not so bad design

tl;dr; - I need help creating an article that clearly promotes PHP.

I was wondering. I know PHP isn’t perfect. However, I feel it gets way too much of a bad wrap. And it seems every time I come up to a discussion on the pros and cons of PHP, almost always this article gets quoted

PHP: a fractal of bad design

and the poster just says something like, “Ha, look at this blog post and decide for yourself!”.

What is even worse, people who are asking about learning a language are also pointed to that article and told, “Read that blog post and decide for yourself!”

I feel this has to stop. PHP really doesn’t deserve that.

One main reason is, that article will be coming up to its 4 year birthday this year in April and we all know PHP has improved considerably in those 4 years. So, I thought I’d go through the trouble of writing a new blog post, with the same title as the title of this thread. What I am looking for from the community is hard core arguments, where the points made in the blog are now incorrect.

I’d also venture to argue against some of the comments, which are clearly based on the perspective. I think I am lucky, I am not as “knee deep” in the language as Eevee (if the article weren’t written so well, I’d question taking in the facts from a ranting Pokemon, LOL!), so my perspective isn’t yet so skewed. Maybe. I don’t know. Still, I am a fan of PHP. It has to be doing something right, since it powers 80%+ of the web. Right? If we are programmers of the language, it is our duty to properly support is, both in honest and open critique with real issues, but also to show its strengths. I’ve learned that success isn’t determined by weaknesses. It is determined by strengths.

I found other articles also countering Eevee’s rant.

http://php.vrana.cz/php-a-fractal-of-not-so-bad-design.php
http://pp19dd.com/2012/07/php-hammer-not-a-fractal-of-bad-design/
http://blog.ircmaxell.com/2012/04/php-sucks-but-i-like-it.html

And there are articles for PHP out there too, but they seem to be a lot rarer, than the articles against PHP. Some articles are fairly good, but touch mainly on the overarching advantages.

http://www.eggslab.net/why-to-choose-php/
http://customwebsitedevelopement.blogspot.de/2015/04/12-reasons-to-choose-php-for-developing.html
http://www.nexgendesign.com/why-you-should-choose-php-for-your-next-project

Should the overarching advantages outweigh the details? Maybe.

But for sure, we need a better article to fight for PHP and counter the 4 year old article/ rant. My challenge will be to do the following, if I can find the support, from you, the community of Sitepoint PHP.

  1. Counter the falsehoods of the factual details. Some were correct back then. Some were wrong too. But for sure, now a good number are false.

  2. To point out the facts that are still true. We want show we are not oblivious to the issues.

  3. Counter the perspective, if it is clear it is causing a skewed opinion. This is rarer, but I still see it personally.

  4. List off the strengths of PHP.

  5. Publicize the article on Sitepoint. However, I would request Sitepoint somehow take the proceeds of any advertisement revenues won by the article and give it to a charity. It will be a Sitepoint PHP community effort and as such, I think Sitepoint shouldn’t be earning any revenues directly from those efforts. This is just a suggestion. Obviously, nothing like this has been done before. I think it would be a great message both for Sitepoint and for the PHP community here and outside of Sitepoint.

  6. Get the article finished and published by the 9th of April, 2016.

  7. Do my best (with your help) to make sure it wins the hearts of new programmers and instills confidence in current programmers. We need a new article for people to link to, when the “PHP, is it something worth using/ learning?” questions arise.

I need your support with points 1-4. I hope I can get it, because if I wrote this article alone, I’d get shot down for certain for my lack of experience and because of my lack of experience, it just wouldn’t be very good. Together though, as a community, we can very well make a positive dent in the web application programming universe promoting PHP, and I really think it is worth it! We need to start polishing off the PHP tarnish. I hope you feel the same way. :smile:

Scott

edit: my effort to put the article together will also be a donation.

3 Likes

Hi Scott,

Let’s start from the most basic question.
Why do people learn programming languages?
Some of them do that for fun, but obviously most people learn them to get a job and earn money.
That is the only fact that matters in real life.
True programming gurus may continue their arguments but that is not interesting for anyone except themselves. Programming language should allow you to make money. That’s it.

So, let’s compare PHP with other webdev languages using only parameter that really matters.
The question is “How easy is it to get a PHP/Ruby/Python/whatever-else job?”
Let’s google and see the number of results.

Ruby on Rails job: ~9 540 000 results
Python job: ~40 600 000 results (take in note that Python is not webdev-only language)
ASP NET job: ~74 900 000 results

… and …

PHP job: ~553 000 000 results

You’ll get close ratio on any of job listing sites.

The fact that PHP gives ~50 times more chances to find a job is enough to make a choice, isn’t?
This difference is so enormously huge so there is nothing to talk about.
PHP is bad? Maybe. But who cares?

Those IT guys who complain about PHP are just forgetting about the main point. Each piece of software has created to be sold. It’s a business. Who would care about “redundancy” and “inconsistency” if PHP allows you to bring quick-and-dirty prototype (which is more than enough often) in few moments and start earning money much faster? And if you want to change your PHP developer it will take you a single day. Or you can search for decent Ruby programmer for months.

It’s a battle between workers and enterprenuers. Workers (programmers) want to use cool and fancy tools (PHP is not that kind of tool, definitely). On the other side, enterprenuers want to become rich and PHP really helps them to do that. Facebook is bad example? Haha.

6 Likes

@megazoid - thanks for the input! That is exactly what I am looking for. That and also the details too.

I’d like to extend this to: Programming languages are there to create software and applications, from which money can also be earned, either as a service while performing the programming process or as a producer of a software product.

Scott

1 Like

I would like to add that the article is hugely exaggerating the problems in that long list. The list is very long, contains valid arguments for each flaw and thus gives the impression that all these flaws surmount to a big problem with PHP. Whereas in practice all those flaws rarely matter when programming real stuff:

  • Comparing NULL to 0 or -1? Maybe incorrect but who uses that?
  • Loose number to string comparisons? Sure, maybe a bit complicated but this helps the newbies most of the time. Still, it’s very easy to learn all the loose comparison rules that really matter in practice - if we don’t deliberately look for obscure and never used stuff like comparing NULLs to numbers, arrays with different number of elements, or range comparisons between objects.
  • Inconsistent function names? Maybe, but the truth is that when we need to do something practical it’s easier to search the excellent documentation than to do the same thing in another, more elegant language. Not to mention IDEs provide function autocomplete and you don’t even have to read the docs.
  • Complaining about syntax like , [key => value], (int)? What kind of rant is that? Who really cares? It’s obvious every programming language will have its own syntax.

In short, if you deliberately look for flaws then it’s possible to find most of them in PHP. But they rarely matter when programming real stuff. Sure, one has to read the docs and learn about some of the language peculiarities but that’s not really that hard. Entry level to the language is very low and this is what matters to most. And with recent development PHP has become a mature language even for large applications.

The whole article is blowing the problems out of proportion.

2 Likes

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

8 Likes

I like this perspective. Thanks!

As for the type comparison/ weak/ loose typing argument, I think it is clear PHP7 has the first additions to counter this critique. I would like to mention them.

Documentation is a clear strength!

Nice and I agree!

And unfortunately, the article is so meticulous and well written, that it still gets way too much of what I would call the wrong attention. We need an equally meticulous and well written article, which is much more up-to-date, less rant and more positive, which hopefully will get the right attention. :smile:

Scott

2 Likes

I love that quote. That could be a great lead into the article!

Scott

1 Like

Another quote that springs to mind is “a bad craftsman blames his tools”.

How many programmers check a function’s return value or even know the majority of functions actually have a return value?

C and Pascal were languages I learnt before Php and now delighted that eventually Php 7 is now giving the option of similar Strict programming practice. Php will only get better.

Let me share some real life experience how good php can be in comparison with other languages - specifically Ruby. I had a client (I didn’t program anything for him in this case) whose web site and cms were made by a company who were all advocates of Ruby on Rails as a superior platform, one for true programmers. I actually met with the programmers - young and enthusiastic guys who were clearly fascinated with programming, from the conversation it could be felt it’s something they liked and they chose Ruby on Rails because it was a much more elegant platform than php. My goal was to suggest a few changes and improvements to the site that they would do for the client. It turned out that any simple change to the system was a difficult and huge undertaking for them consuming many costly man hours - for example: adding http redirects at certain URLs, making SEO-friendly URLs for a few pages or providing a plain text field for html content instead of a rich text editor in the CMS - all of those little things that are a matter of minutes in an averagely designed php system required “deep and costly” changes to their sophisticated system, which seemed to have little flexibility - or were outright impossible for mysterious reasons unknown to me, the inexperienced guy (I don’t know Ruby after all). Finally, they were fired for various problems with the site, too numerous to list them here - but all the time they appeared to be proud of their programming. Now a different company took over and the site works under php.

Another case - a pretty large local community site was being renewed in Ruby - I had the opportunity to be one of the programmers but I declined because I didn’t know Ruby. For two years I saw the site struggling with very slow page load times and slow pace of development until finally I saw a completely new version of the site working well and smoothly, written in php, of course.

Obviously, this doesn’t prove much because my sample rate is only two cases and the reasons for failures might not have had anything to do with Ruby being a worse language. But it shows that in practical terms it’s more difficult to support a site in an elegant language than in php - probably because it’s more difficult and pricey to find good hosting, good enough programmers, administrators, good support, etc.

5 Likes

Haha, absolutely.

Ruby is great. Let’s see what I have to do to create a simple landing page with subscription form using Ruby. Create controller… define routes… add a model… make templates… Classes, classes, classes… Stop, really? Do I really have to be so pro to solve such simple task? HTML page with 10 lines of embedded PHP does that 10 times faster. Yeah, it won’t look so “professional” but hey, good code is not a goal by itself. From the business point of view it doesn’t really matter what’s inside your code until it works and solves business tasks. Complaining “PHP is ugly” is like complaining why BMW M5 has so complicated engine design. Who cares? It just works and I don’t have to be a Michael Schumacher to drive it.

1 Like

That is a good little quote. Eevee (the author of the PHP: a fractal in bad design) used the analogy of PHP being a tool box full of funky tools. Sure you can get the job done, but you still have to do some “figuring out” of how to use those tools, before you can start doing more than the simple stuff. I like your analogy too, but how off is his analogy? Isn’t there some truth to it?

Scott

Which is why these sort of debates and articles are useless. Ruby on Rails is a framework. Creating one simple page may take some effort but creating and maintaining several dozen complex pages is much easier using a framework.

If you want a simple page then just use Ruby without the Rails. Pretty much the same as php.

Although that’s not a selling point for the programmers :smiley:

I’d agree

Yep lol.

Unfortunately, the article from Eevee isn’t useless. In fact, it is outright destructive.

And, you’re input in this discussion was good and useful too. :smile: You’ve pointed out we need to always remember to compare the same things. Apples with apples and oranges with oranges.

Scott

Evidence please? The article is a rant like millions of other internet rants. Experienced developers will scan it and smile. Inexperienced developers will probably never read it and, if they do, probably won’t understand it.

Perhaps you could explain in more detail who your intended target is?

1 Like

Linked in one of the answers with 2.8K views.

Link in the first answer. Same guy who linked in the above thread.

Another discussion where it is linked. Granted, pretty deep into the conversation. I like how some of the more pro-php answers got to the top.

https://www.reddit.com/r/PHP/comments/1fy71s/why_do_so_many_developers_hate_php/

Another (older blog) linking to the article.

http://blog.codinghorror.com/the-php-singularity/

A site that will give you eye cancer, also linking to the post. It also has a lot of other links to negative PHP sites.

http://webonastick.com/php.html

Linked again.

https://wiki.theory.org/YourLanguageSucks#PHP_sucks_because

Not so busy a question, but still again linked and in 2015.

https://www.quora.com/Can-PHP-handle-backend

And again.

https://www.quora.com/Is-PHP-still-a-good-programming-language-for-developing-web-applications-or-are-there-better-alternatives-2015

Seems like the people on Quora like to get people to that blog post.

Another very recent post, still linking to that article. The author admits it is old, but still truthful. Is it still truthful?

http://suckyninja.azurewebsites.net/leaving-php-is-too-expensive/

I could continue. There are 10s of pages of search results just from 2015 linking to that blog post.

I’ve also noticed through this question, that PHP is generally “hacked on” quite a lot (pun not intended). How sad that is.

Scott

1 Like

Perhaps one of the truths about PHP that is a negative is that it makes things too easy for people without a proper programming background to start using it.

The presence of lots of ridiculous security holes such as

$email = $_POST['email];

effectively tainting ALL variable names instead of keeping the ones that don’t start with $_ (apart from a few known exceptions) as untainted.

Other languages that are harder to use are more likely to have had the people using it having been exposed to the “introduction to the introduction to the most basic aspect of security” and so they do dot make this worst of security errors in their code.

That you only ever see this horrible security hole in PHP code helps to give it a bad reputation as this means that PHP is not only a target due to the high number of people using it but also there is a greater likelihood of success in breaking in due to the programmer not knowing for certain that invalid values are being blocked

1 Like

Hmm…I would have considered PHP’s low entry threshold to be a strength. And isn’t it true that everyone has to start off as a beginner at some point? If I were in charge of a programming language, I’d want as many beginners starting off with my language than any other. It’s just that I’d also want to do my best in teaching them how to use it. Hmm…I am glad I am not in charge of a programming language. :blush:

Scott

2 Likes

I’ve been a programmer for well over 40 years :gulp: and I still make some howlers in PHP.

2 Likes

Could you expand on that a bit?

Scott

1 Like