PHP's Bad Reputation

  • (9 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »

123 Replies - 35660 Views - Last Post: 15 January 2013 - 12:14 PM

#16 e_i_pi  Icon User is offline

  • = -1
  • member icon

Reputation: 795
  • View blog
  • Posts: 1,681
  • Joined: 30-January 09

Re: PHP's Bad Reputation

Posted 10 January 2013 - 08:01 PM

View PostTayacan, on 11 January 2013 - 08:50 AM, said:

Here are some examples of weird stuff in PHP.

I too remember reading this article a while back, I think in another topic here in Advanced PHP. The author's passion struck me - I would not be surprised if the author was at some stage a PHP developer who got the boot for submitting poor code and/or not getting up to speed with the language.

In one part of the article, he mentions something about PHP being like a bad toolkit, and the only thing able to be created from it as being a broken house with upside-down pentagonal rooms (which actually sounds kinda cool), but I get was he was aiming at. I refute this argument, and I'll give a real world analogy. A few weeks ago I was putting together a demountable greenhouse. I had to tie the canopy down using supplied cable ratchets. I ended up feeding the cables through every ratchet in the wrong direction, meaning I couldn't quick release the cables and hence couldn't move the greenhouse. So, I got my shifter, jimmied open all 4 ratchets (each with about 16 pieces), and rebuilt them using my hands and the shifter. The job really called for needle-nose pliers, a socket wrench and a screwdriver. But I managed with just the shifter, and now the cable ratchets work perfectly. I completed the job with the wrong tools - because I was versatile, I adapated, and I made sure that the end goal was not lost amidst the shortcomings of the tools I was working with. Why did I use the wrong tools? Because I didn't feel like going out and spending $50-150 on tools, a sentiment I have with Micro$ofts IDE/server/platform market.

I've seen plenty of bad code in various languages, and when it comes down to it, in my opinion, the problem is by and large the coder and not the language. I won't staunchly defend PHP to the hilt, but nor will I get on my high horse and start slinging mud at other languages. I feel that the amount of pissing matches (not that any are going on here) about languages is strongly fuelled by the misconception ICT/CompSci students get about their relative importance when compared to other workers in society. A good portion of the IT professionals I have met have had some sort of complex where they look down on others, and feel that they are smarter and/or more important. I studied Maths at Uni - it took me 5 years. I learnt programming in my own time, without a job for work experience, and came up to a level where I can get a high-paying job within 3 years of starting to learn about code. Programming isn't for everybody, but it's hardly exclusive in terms of the wits or wisdom required to pick it up.

[/rant]

I'll close with a story from my workplace that happened just before Christmas. We code in C#, though I use VBScript as I work with BIDS. We just got a junior developer on, and I asked him what languages he knows. He rattled off a few, but PHP was missing. I asked him whether he's ever used PHP. He said that PHP was broken, it was no good compared to other languages, and nobody should use it. I asked him why. He then went on to say that in 2nd year Uni, they covered PHP and another 7 languages over a 2 week period, and the lecturer told them it was no good, broken, shouldn't be used. This made me quite sad, as apparently even in a field of science where analytical and careful thought should be the beacon, there was still blatant bigotry and elitism that served no purpose other than to antagonise, enflame, and breed narrow-mindedness
Was This Post Helpful? 3
  • +
  • -

#17 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7757
  • View blog
  • Posts: 13,120
  • Joined: 19-March 11

Re: PHP's Bad Reputation

Posted 10 January 2013 - 08:33 PM

Quote

The author's passion struck me - I would not be surprised if the author was at some stage a PHP developer who got the boot for submitting poor code and/or not getting up to speed with the language.



This is an interesting reflex: you disagree with his conclusions, so you start out by making up stories that cut at his competence.
I don't know who the guy is or what he's done, but it's clear to me that he's thought a lot about this and made a lot of pretty keen observations. You might disagree with him, but he's certainly starting out making a strong case, and you don't do your arguments any favors by leading with a personal attack.

Quote

I refute this argument, and I'll give a real world analogy.


You have not refuted his argument. You haven't even gotten to his argument.
The argument presented is that the toolkit offered by PHP is, in general and in many particulars, poorly engineered and poorly made, and not suited to the tasks it's asked to perform.

Your argument is that someone using bad tools can produce good work. This seems to concede the position you're arguing against - it certainly doesn't refute it.

Quote

in my opinion, the problem is by and large the coder and not the language.


Many people - myself among them - would claim that, while it is obvious that some programmers are better than others and some programmers should simply be taken out back and shot out of a cannon as part of a circus act instead of being programmers it is also the case that language design makes a difference, and that good design can make it easier to write good code and harder to write bad code. Do you this position, or do you feel that the design of the language is irrelevant, that the same programmer will produce approximately the same number of mistakes writing the same code in any two arbitrary languages?
Was This Post Helpful? 4
  • +
  • -

#18 e_i_pi  Icon User is offline

  • = -1
  • member icon

Reputation: 795
  • View blog
  • Posts: 1,681
  • Joined: 30-January 09

Re: PHP's Bad Reputation

Posted 10 January 2013 - 08:58 PM

View Postjon.kiparsky, on 11 January 2013 - 01:33 PM, said:

This is an interesting reflex: you disagree with his conclusions, so you start out by making up stories that cut at his competence.

I'm pointing out that he's awfully passionate about something he dislikes. In my experience, you only get that way when you're subjected to the object of disgust over and over again. Hell, I don't like poached eggs, but I don't write a web article about it that cascades over about 20 pages.

Quote

Quote

I refute this argument, and I'll give a real world analogy.

You have not refuted his argument. You haven't even gotten to his argument.
The argument presented is that the toolkit offered by PHP is, in general and in many particulars, poorly engineered and poorly made, and not suited to the tasks it's asked to perform.

Your argument is that someone using bad tools can produce good work. This seems to concede the position you're arguing against - it certainly doesn't refute it.

You're reading me wrong. Think of it like this - I disagree with his argument in that it is elitist and leans towards using the most advanced tools for the job, when it is a fact that the only tools necessary are those that do the job. As an example, I would never use MySQL in my applications, I don't like the limitations or design of MySQL, yet I can see the benefits of using MySQL especially for new programmers. It's commonplace, it's easy, tutorials are abundant, it's forgiving, it's lightweight, and it satisfies the vast majority of common DB requirements. It's a tool, it does a job, end of story. It's not Oracle, it's not MSSQL, it's not PostgreSQL, but it is a DB. By the same token, I drive a beat up '93 model Subaru, not a Maserati GranTurismo.

Quote

Many people - myself among them - would claim that, while it is obvious that some programmers are better than others and some programmers should simply be taken out back and shot out of a cannon as part of a circus act instead of being programmers it is also the case that language design makes a difference, and that good design can make it easier to write good code and harder to write bad code. Do you this position, or do you feel that the design of the language is irrelevant, that the same programmer will produce approximately the same number of mistakes writing the same code in any two arbitrary languages?

I think language design is one aspect of developing an application, whether it be web-based or not, but it is just one aspect. Granted it underpins things, and when you build on shaky foundations, you can expect a tumble. The inconsistencies in PHP are not something I would defend, but they aren't fatal when it comes to designing your own application. Any application that is more than a simple tool/page ends up using a vast amount of custom code/functions/methods/classes/what-have-you anyhow, which eventually means that coding consistency and adherence to coding styles/practices becomes far more important for application maintenance and support.
Was This Post Helpful? 0
  • +
  • -

#19 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7757
  • View blog
  • Posts: 13,120
  • Joined: 19-March 11

Re: PHP's Bad Reputation

Posted 10 January 2013 - 09:17 PM

Quote

Any application that is more than a simple tool/page ends up using a vast amount of custom code/functions/methods/classes/what-have-you anyhow, which eventually means that coding consistency and adherence to coding styles/practices becomes far more important for application maintenance and support.


This is a good point. Here you're giving a good mechanism whereby programming style can overwhelm language effects. But what about the countercase - since there is a lot of infrastructure and superstructure that a programmer creates, and since that infrastructure really should be as solid as possible, shouldn't we look for a language which is best suited to creating those structures?
Particularly, shouldn't we look for something which encourages modularity and functional design over massive globalism? Or one which simply break on certain errors, like mistyped variable names, instead of carrying on with a best-guess optimism.
That is, shouldn't your language strive to minimize complexity, rather than multiplying it?
Was This Post Helpful? 1
  • +
  • -

#20 ishkabible  Icon User is offline

  • spelling expret
  • member icon




Reputation: 1622
  • View blog
  • Posts: 5,709
  • Joined: 03-August 09

Re: PHP's Bad Reputation

Posted 10 January 2013 - 09:19 PM

*
POPULAR

Quote

It's never nonsensical. There are different levels of errors the code can issue, and PHP handles each of them in a clearly defined manner. A fatal error (E_ERROR) stops the script execution. Anything less (E_WARNING and E_NOTICE, for example) will not stop the script execution, but be logged and the script will continue in whatever manner it would have otherwise. - Of course, the path of the execution will differs based on return values from the functions responsible for issuing the non-fatal errors, and those are often mishandled by the developer. That, however, can hardly be attributed to PHP doing things in a nonsensical manner. PHP just does no more or less than exactly what it was told to do.


I'm talking about it's nasty conversions and such.

one of my co-workers showed me this one
5 + "10 bananas" == 15



there are just so many things were it trys to interpret what the programmer might have meant and does silly things instead of doing what it should and reporting an error. the only cases where it does report an error is when even it can't think of a silly thing to do. I wasn't talking about errors at all, I was talking about the lack of them. lack of exceptions that should be thrown, lack of fatel errors where there should be, lack of warnings, lack of notices.

I will admit 5.4 has better warnings and notices but we only just switched to that as I was leaving. maybe it was just our configuration (which only the sysadmins had access to) but it seemed like 5.2 hardly ever gave out warnings.

O and about threading, I ran into a 1% case at work where I actually wanted multi-threading. We wanted an email queue and didn't really like any of the options we had so we implemented a basic one for our needs. Because it was a global email queue it just ran with a scheduled task in a single thread. It ended up getting a little back logged so we looked at speeding it up. It was easy to make parallel if we had had even something like 'fork'. That's a more minor thing but it did bite me once. Last I checked they were looking at re-writing the email queue in C# to improve performance and make it parallel.

This post has been edited by ishkabible: 10 January 2013 - 10:05 PM

Was This Post Helpful? 7
  • +
  • -

#21 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7757
  • View blog
  • Posts: 13,120
  • Joined: 19-March 11

Re: PHP's Bad Reputation

Posted 10 January 2013 - 09:20 PM

I wish I could upvote that example a hundred times.
Was This Post Helpful? 0
  • +
  • -

#22 e_i_pi  Icon User is offline

  • = -1
  • member icon

Reputation: 795
  • View blog
  • Posts: 1,681
  • Joined: 30-January 09

Re: PHP's Bad Reputation

Posted 10 January 2013 - 09:30 PM

Quote

shouldn't your language strive to minimize complexity, rather than multiplying it?

This is true, but it does come down to what you are developing. I guess as an ideal, yes you would want your language to be as perfect as possible, but that's simply not the case with PHP, nor with any other language. I also maintain that it is one aspect, an aspect that is vitally important when it comes to future-readiness, adaptability, and extensibility of an application, but not the leading decision point in quite a few scenarios. Depending on what we are doing, we have to take into account other aspects, such as general approachability of the language, how quickly one can learn the language, ease of access to the language's support tools (IDEs, servers, etc), quality and quanityt of tutorials/peer support, financial affordability of the language software/support tools, prevalance of income-generating roles that utilise the language, etc.

This post has been edited by e_i_pi: 10 January 2013 - 09:33 PM

Was This Post Helpful? 0
  • +
  • -

#23 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1368
  • View blog
  • Posts: 3,455
  • Joined: 28-November 09

Re: PHP's Bad Reputation

Posted 10 January 2013 - 09:37 PM

*
POPULAR

A programming language's purpose is to provide a predictable abstraction and interface to computational operations in clear and concise wording. If the language is not predictable, it fails, whether or not you can still use it.

PHP is not entirely predictable. Hundreds of edge cases and exceptions does not mean something is predictable, it means that it was poorly designed without a solid vision. Predictability is rooted in the practice of uniform and predictable returns given errors or other values.

PHP is not clear and concise. Ruby and Perl have multiple ways to do the exact same thing, but all return the same way. PHP has multiple ways to do things, many of which do completely different things in very unclear fashions. This does tie into predictability, but I believe it needed a separate point.

Now why rag on something like Rails? It's effective at what it does, has a very dynamic and strong language at its core, and behaves exactly how you expect it to (at least in my experience.) It provides extremely strong abstraction (with admittedly bad generated code with tables) that allows tasks to be done infinitely quicker. Buzz? It's earned it by now.

The difference? Ruby is a very very powerful language, and a solid base core to Rails. That very foundation is what gives it its true power.

Want to really push it on web power? Weblocks is your thing.
Was This Post Helpful? 6
  • +
  • -

#24 raghav.naganathan  Icon User is offline

  • Perfectly Squared ;)
  • member icon

Reputation: 408
  • View blog
  • Posts: 1,440
  • Joined: 14-September 12

Re: PHP's Bad Reputation

Posted 10 January 2013 - 09:47 PM

Well, now the question is "To PHP or not to PHP?"...more points and ideas are present about this in this link.

regards,
Raghav
Was This Post Helpful? 1
  • +
  • -

#25 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1368
  • View blog
  • Posts: 3,455
  • Joined: 28-November 09

Re: PHP's Bad Reputation

Posted 10 January 2013 - 09:57 PM

Then again at the same time, prescribing to any form of lingual zealotry is equally foolish. No language is perfect (except LISP) and all languages have their flaws (except LISP) and to say that one language reigns in absolute superiority is naive at best (because we all know it's LISP.)
Was This Post Helpful? 0
  • +
  • -

#26 e_i_pi  Icon User is offline

  • = -1
  • member icon

Reputation: 795
  • View blog
  • Posts: 1,681
  • Joined: 30-January 09

Re: PHP's Bad Reputation

Posted 10 January 2013 - 10:03 PM

I'm not familiar with LISP, but the Wikipedia article points towards it using Polish Prefix Notation. I'm not sure how prevalant it is in LISP, but if it's anything like this...

Quote

/ 10 5 = 2 is read as "divide 10 by 5"

In Soviet Russia...
Was This Post Helpful? 0
  • +
  • -

#27 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7757
  • View blog
  • Posts: 13,120
  • Joined: 19-March 11

Re: PHP's Bad Reputation

Posted 10 January 2013 - 10:06 PM

Lisp is an incredibly powerful and flexible language that inspired almost all modern languages to some degree.
It's generally held languages are powerful and flexible to the degree that they resemble lisp.

This perception is correct.

This post has been edited by jon.kiparsky: 10 January 2013 - 10:08 PM

Was This Post Helpful? 2
  • +
  • -

#28 ishkabible  Icon User is offline

  • spelling expret
  • member icon




Reputation: 1622
  • View blog
  • Posts: 5,709
  • Joined: 03-August 09

Re: PHP's Bad Reputation

Posted 10 January 2013 - 10:09 PM

e_i_pi: to some degree that was just a joke
Was This Post Helpful? 1
  • +
  • -

#29 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7757
  • View blog
  • Posts: 13,120
  • Joined: 19-March 11

Re: PHP's Bad Reputation

Posted 10 January 2013 - 10:10 PM

View Postishkabible, on 11 January 2013 - 12:09 AM, said:

e_i_pi: to some degree that was just a joke


Spoilsport.
Was This Post Helpful? 1
  • +
  • -

#30 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1368
  • View blog
  • Posts: 3,455
  • Joined: 28-November 09

Re: PHP's Bad Reputation

Posted 10 January 2013 - 10:23 PM

View Postishkabible, on 10 January 2013 - 11:09 PM, said:

e_i_pi: to some degree that was just a joke


Was it?

http://www.paulgraham.com/avg.html

Be enlightened! Feel the raw power that is LISP!

I'll stop derailing with satirical lingual religious zealotry (but LISP is a relationship.)

----

My first language ever was PHP and it always drove me mad that it just didn't make perfect and clear sense. It led me to assume that all programming was meant to be hard to understand, that I had to be so much smarter to hope to start programming. It led me to quitting programming at an early age, despising it as confusing and annoying, and taking up art and music instead.

That first experience at 12 made me hate programming so much. It imbued an association in me that programming was just annoying and impossible to comprehend. The exact same could be said about Math with me, I had bad teachers that taught patch jobs and piled homework instead of teaching. Such methods make people detest the field, and that's a tragic thing.

Of course my father called me out on wanting to be an arts major and threw me into Comp Sci where it was C# from there. I didn't like that either. So much clutter, repetition, and annoyance. It further threw me out of programming.

Want to know what saved me? Clarity, conciseness, and elegance. Ruby was beautiful, it just made sense. It was such a beautiful thing, and I understood it all within 1-2 weeks (syntax only of course.) Since that point I started learning several functional languages and C based languages with relative ease. It got me back to a loop in thinking that maybe I just wasn't ready to comprehend PHP yet, that now I was really ready.

So I started back into PHP, forcing myself to learn it, and I came full circle back to my original conclusion that it was quite frankly an annoyance of a patch job. I would not say such things without substantial research done on my part, but quite frankly PHP is an extremely poorly designed language patched together with bits of tape and hacks.

Anyone who starts in PHP will have a severe handicap, and I was a prime example of that. If that's the case, then why in the world would you use it in anything else? Because it's popular? Popularity and hype do not make a good language, ever.
Was This Post Helpful? 2
  • +
  • -

  • (9 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »