Why PHP programmers aren't considered real programmers

GEC: Discuss gaming, computers and electronics and venture into the bizarre world of STGODs.

Moderator: Thanas

User avatar
Starglider
Miles Dyson
Posts: 8709
Joined: 2007-04-05 09:44pm
Location: Isle of Dogs
Contact:

Re: Why PHP programmers aren't considered real programmers

Post by Starglider »

Zixinus wrote:If I get the posts correctly, is PHP fundamentally flawed? Because that is the point that I feel gets across. How did that happen?
Quite a lot of programming languages are someone's personal crappy scripting language that somehow escaped and gained popularity. These are kludged together with no real understanding of language, compiler or library design, and they universally suck. Perl is in this category despite massive efforts put in for over a decade to try and make it into a real language (why anyone would want to, I don't know).

These languages are attractive only because they seem simple and easy to pick up. In actual fact, all the 'counterintuitive' and complex features in other languages are generally there for a reason. Furthermore there are now plenty of properly designed languages that target simplicity and beginners, so really there is no excuse for using junk like PHP except having to maintain legacy code.
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Re: Why PHP programmers aren't considered real programmers

Post by phongn »

Destructionator XIII wrote:PHP was (and is) created by morons for morons. Fundamental technical flaws are the least of its problems. Greater is that the idiots around it don't see them as flaws.
Perhaps one of the few good things about PHP is that it does scale very well (as mentioned earlier) - but that is in spite of its many problems.
Chris OFarrell wrote:Its free, and it has been the mantra of a lot of geeks that Apache + PHP = Liberation...or something.
PHP was early, free, cross-platform and relatively easy to understand. There were not many alternatives when it was created (CGI scripts and Perl come to mind). Nowadays there are many alternatives - but PHP lets you get your feet wet early and is deceptively simple.
Xon wrote:Mysql and secure? Don't make me laugh.

mysql_real_escape_string doesn't protect against against SQL injection properly with dynamic sql even ignoring unicode! Linky.
IIRC, most security sites specifically advice users not to use *escape_string for sanitizing. Also, MySQL is terrible - too bad Postgres made some bad decisions back in the day and let MySQL take the market.
Starglider wrote:Quite a lot of programming languages are someone's personal crappy scripting language that somehow escaped and gained popularity. These are kludged together with no real understanding of language, compiler or library design, and they universally suck. Perl is in this category despite massive efforts put in for over a decade to try and make it into a real language (why anyone would want to, I don't know).
Perl came early with the right features and the right price at the right time. Plus, there was strong demand for something to do string parsing and munging. Of course, now there's so much legacy code and so many Perl gurus they want "sane" Perl.
These languages are attractive only because they seem simple and easy to pick up. In actual fact, all the 'counterintuitive' and complex features in other languages are generally there for a reason. Furthermore there are now plenty of properly designed languages that target simplicity and beginners, so really there is no excuse for using junk like PHP except having to maintain legacy code.
Yeah, but it's popular, free and cross-platform so new people see it and dive right in.
User avatar
Terralthra
Requiescat in Pace
Posts: 4741
Joined: 2007-10-05 09:55pm
Location: San Francisco, California, United States

Re: Why PHP programmers aren't considered real programmers

Post by Terralthra »

Xeriar wrote:Half of my development time with PHP is basically rewriting things I can't trust the php team to have done properly. I think this epitomizes it.
Incidentally, when you write things like

Code: Select all

 $arr = array ();

  for ($i = 0; $i < 100000; $i++)
    {
      $c = mt_rand (0,1);
      if (!isset ($arr[$c])) $arr[$c] = 1;
      else $arr[$c]++;
    }

  ksort ($arr);

  foreach ($arr as $key => $value)
    {
      echo '<b>'.$key.':</b> '.$value.'<br />';
    }
when you could write

Code: Select all

  $arr = array (0,0);
  for($i = 0 ; $i < 100000 ; $i++) {
    $arr[mt_rand(0, 1)]++;
  }
  foreach($arr as $k => $v) {
    echo '<b>'.$k.':</b> '.$v.'<br />';  
  }  
you lose the right to complain about poorly-written code.
User avatar
Ariphaos
Jedi Council Member
Posts: 1739
Joined: 2005-10-21 02:48am
Location: Twin Cities, MN, USA
Contact:

Re: Why PHP programmers aren't considered real programmers

Post by Ariphaos »

I can only have so much respect for people who equate poor optimization (especially for a pruned test case) with an actual failure of implementation.

Anyway.
Starglider wrote:Quite a lot of programming languages are someone's personal crappy scripting language that somehow escaped and gained popularity. These are kludged together with no real understanding of language, compiler or library design, and they universally suck. Perl is in this category despite massive efforts put in for over a decade to try and make it into a real language (why anyone would want to, I don't know).

These languages are attractive only because they seem simple and easy to pick up. In actual fact, all the 'counterintuitive' and complex features in other languages are generally there for a reason. Furthermore there are now plenty of properly designed languages that target simplicity and beginners, so really there is no excuse for using junk like PHP except having to maintain legacy code.
PHP gets out of the way. Far too early, but it has an installed base of pretty much Everywhere, and is getting slowly whipped into shape. It might take a fork to get a proper implementation, however.
phongn wrote:Perhaps one of the few good things about PHP is that it does scale very well (as mentioned earlier) - but that is in spite of its many problems.
I suspect the concept is actually related. Because so much php code is hacked together, quite a lot of the most important parts (getting information from the database to the server) gets tweaked for speed. And occasionally they notice about security.
Yeah, but it's popular, free and cross-platform so new people see it and dive right in.
php.net's documentation is currently king. Pretty much the sole reason. Problem with anything? Look it up.
Give fire to a man, and he will be warm for a day.
Set him on fire, and he will be warm for life.
User avatar
Terralthra
Requiescat in Pace
Posts: 4741
Joined: 2007-10-05 09:55pm
Location: San Francisco, California, United States

Re: Why PHP programmers aren't considered real programmers

Post by Terralthra »

Xeriar wrote:I can only have so much respect for people who equate poor optimization (especially for a pruned test case) with an actual failure of implementation.
It's not "poorly optimized," it's "badly written." It has extra control structures for no conceivable reason, which make it hard to read and understand, pointlessly. If you really, for some reason, didn't want to initialize the array when you declared it (I am guessing you started with a much larger array, due to the pointless ksort, and pruned it down to 0/1? Filling with 0 manually in that case would be tedious), $arr.fill(0) works just fine.
Xeriar wrote:
Yeah, but it's popular, free and cross-platform so new people see it and dive right in.
php.net's documentation is currently king. Pretty much the sole reason. Problem with anything? Look it up.
The fact that you have to read through the comments section with various posts of questionable expertise and veracity to answer most questions and read about known issues somewhat negates this.
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Re: Why PHP programmers aren't considered real programmers

Post by phongn »

Xeriar wrote:
Yeah, but it's popular, free and cross-platform so new people see it and dive right in.
php.net's documentation is currently king. Pretty much the sole reason. Problem with anything? Look it up.
PHP.net's documentation is not "good".
User avatar
Terralthra
Requiescat in Pace
Posts: 4741
Joined: 2007-10-05 09:55pm
Location: San Francisco, California, United States

Re: Why PHP programmers aren't considered real programmers

Post by Terralthra »

Destructionator XIII wrote:FUCK MY KEYBOARD WITH A BACK BUTTON NEXT TO THE SHIFT KEY

FUCK FUCK FUCK
Terralthra wrote:It's not "poorly optimized," it's "badly written." It has extra control structures for no conceivable reason, which make it hard to read and understand, pointlessly. If you really, for some reason, didn't want to initialize the array when you declared it (I am guessing you started with a much larger array, due to the pointless ksort, and pruned it down to 0/1? Filling with 0 manually in that case would be tedious),
Think for a minute. His code is easily altered. If he wants to change the range of the random numbers generated, it is a one line change - the mt_rand arguments. He can punch in any values and it will just work.

Not so with any of your suggestions. Changing it from 0-5, for example, requires two lines changed: the mt_rand and the array constructor.

Moreover, your suggestion is needlessly wasteful of memory and performance, initializing an (associative) array that is never used.

Consider 10-20. In his code, change mt_rand and boom. On your code, what will you do? Construct a 20 element array and waste half the memory? Make it 10 elements and subtract 10 from the returned value? Lol.

Or, the most likely case: mt_rand() with no arguments, goes between 0 and RAND_MAX which is something like 2^31. Do you suggest that he allocate 2 GB * sizeof(php arr element) of memory up front?

Fucking lol, especially with only 100,000 iterations. Less than 1/1000 of that memory will ever even be used - it is sparsely and randomly populated. The very definition of where a lazy AA is meant to be used.


For the simple 0 and 1 case, your code is a bit nicer (saves two lines! woooo!) but for almost any other conceivable case, his code is vastly superior.


The real incompetence here is you throwing out the initial ad hominem (yeah, dismissing someone's points because of a "failing" in personal style is really logical. oh wait, it's a textbook fallacy) and then having your own defense of it lead the way to knocking you right on your ass, but you fail to see it! And you make the sweeping "inconceivable" claim.

Christ.

Finally, does php even have an arr.fill() function? I didn't think it did.
Not only does it have a fill function, it completely obviates your complaint, since the fill function can take as additional arguments the range of values you wish to fill. Want to do 10 - 20? $arr.fill(10, 20, 0). So, not only did the function you didn't think existed exist, it also does what you didn't think it could do.

If you think you could adequately test an RNG across a spread orders of magnitude greater than the number of iterations, I don't know where you learned statistics. A sparsely populated RNG test array would be meaningless. If mt_rand were between 0 and 2^31, he would doubtless have incredibly more iterations in order to have any meaningful results. And yes, said program would be a memory hog, either way.

His code is also harder to read. That is not a trivial complaint. That it has "more lines" is not the key point. It has extra control structures; moreover, these control structures do not actually reflect the logic of the code. This is bad on two levels. If he really wanted to be sure that "he only had to change it in one place" in order to run a different test case, he could put in defined constants and use them in both places. Note that this would be more lines, but more easily read yet.
User avatar
Ariphaos
Jedi Council Member
Posts: 1739
Joined: 2005-10-21 02:48am
Location: Twin Cities, MN, USA
Contact:

Re: Why PHP programmers aren't considered real programmers

Post by Ariphaos »

Terralthra wrote: It's not "poorly optimized," it's "badly written." It has extra control structures for no conceivable reason, which make it hard to read and understand, pointlessly. If you really, for some reason, didn't want to initialize the array when you declared it (I am guessing you started with a much larger array, due to the pointless ksort, and pruned it down to 0/1? Filling with 0 manually in that case would be tedious), $arr.fill(0) works just fine.
The original code was testing a function that generated random strings of various lengths and levels of randomness, where certain characters are forbidden (cookie storage), and I was doing various tests on that. I didn't rethink it after adjusting the test case, it being a test case.

After I posted the code I realized it sucked and was wondering how long it would take for someone to bitch about it. It seems most people here are perfectly fine with assuming something completely different is going on from what is presented.
Terralthra wrote:The fact that you have to read through the comments section with various posts of questionable expertise and veracity to answer most questions and read about known issues somewhat negates this.
It makes it of disputable quality, yes, but I was referring to its accessibility.
Give fire to a man, and he will be warm for a day.
Set him on fire, and he will be warm for life.
User avatar
Jeremy
Jedi Master
Posts: 1132
Joined: 2003-04-30 06:47pm
Location: Hyrule

Re: Why PHP programmers aren't considered real programmers

Post by Jeremy »

Approximately, how long would it take for me to read enough and have enough hands on experience to know how to do any of this?

The most advanced "code" I knew was how to set the background color in HTML and I don't really remember that right now. To the point, I have to take a COP 2220 course in the summer, what do I need to learn before putting my ignorant butt into it?
• Only the dead have seen the end of war.
• "The only really bright side to come out of all this has to be Dino-rides in Hell." ~ Ilya Muromets
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Re: Why PHP programmers aren't considered real programmers

Post by phongn »

Jeremy wrote:Approximately, how long would it take for me to read enough and have enough hands on experience to know how to do any of this?
Why not try it?
The most advanced "code" I knew was how to set the background color in HTML and I don't really remember that right now. To the point, I have to take a COP 2220 course in the summer, what do I need to learn before putting my ignorant butt into it?
COP 2220 looks like a basic introductory course: you should know how to use a computer.
User avatar
Jeremy
Jedi Master
Posts: 1132
Joined: 2003-04-30 06:47pm
Location: Hyrule

Re: Why PHP programmers aren't considered real programmers

Post by Jeremy »

phongn wrote:
Jeremy wrote:Approximately, how long would it take for me to read enough and have enough hands on experience to know how to do any of this?
Why not try it?
I Intend to, but I want to know what I am embarking on.
phongn wrote:
Jeremy wrote:The most advanced "code" I knew was how to set the background color in HTML and I don't really remember that right now. To the point, I have to take a COP 2220 course in the summer, what do I need to learn before putting my ignorant butt into it?
COP 2220 looks like a basic introductory course: you should know how to use a computer.
It is programming in C.
• Only the dead have seen the end of war.
• "The only really bright side to come out of all this has to be Dino-rides in Hell." ~ Ilya Muromets
User avatar
Ace Pace
Hardware Lover
Posts: 8456
Joined: 2002-07-07 03:04am
Location: Wasting time instead of money
Contact:

Re: Why PHP programmers aren't considered real programmers

Post by Ace Pace »

So? If it's an intro course, they'll probably walk you through what a compiler is, how to use it, etc. before setting you loose to write code.
Brotherhood of the Bear | HAB | Mess | SDnet archivist |
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Re: Why PHP programmers aren't considered real programmers

Post by phongn »

Jeremy wrote:I Intend to, but I want to know what I am embarking on.
Some people won't "get it". Some people will pick it up very quickly. Some people will persevere through hard work. I really don't know how long it will take you to do it.

But - as a quick-and-dirty gauge: how good are you at logic, reasoning and mathematics?
phongn wrote:
Jeremy wrote:The most advanced "code" I knew was how to set the background color in HTML and I don't really remember that right now. To the point, I have to take a COP 2220 course in the summer, what do I need to learn before putting my ignorant butt into it?
COP 2220 looks like a basic introductory course: you should know how to use a computer.
It is programming in C.
Yes, I know (go go unified Florida course codes!) I looked at syllabi for that course code and it looks like the a basic introductory course. They'll teach you the basics and will not assume you have had prior programming practice. Take the course. If you have trouble go to office hours, find a study group, etc.
User avatar
Jeremy
Jedi Master
Posts: 1132
Joined: 2003-04-30 06:47pm
Location: Hyrule

Re: Why PHP programmers aren't considered real programmers

Post by Jeremy »

phongn wrote:But - as a quick-and-dirty gauge: how good are you at logic, reasoning and mathematics?
Below average I assume since I had to take DifEq twice. I didn't even like math until I took Calculus and then discovered it was enjoyable. Shamefully enough that is where I finally grasped algebra also.
• Only the dead have seen the end of war.
• "The only really bright side to come out of all this has to be Dino-rides in Hell." ~ Ilya Muromets
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Re: Why PHP programmers aren't considered real programmers

Post by phongn »

Jeremy wrote:
phongn wrote:But - as a quick-and-dirty gauge: how good are you at logic, reasoning and mathematics?
Below average I assume since I had to take DifEq twice. I didn't even like math until I took Calculus and then discovered it was enjoyable. Shamefully enough that is where I finally grasped algebra also.
Well, that's not quite a good sign but there are a lot of programmers who aren't so hot at maths, either. Take the course and see how it goes. If you keep banging your head against the wall and it doesn't "click" - stop.

What university are you going to?
User avatar
Starglider
Miles Dyson
Posts: 8709
Joined: 2007-04-05 09:44pm
Location: Isle of Dogs
Contact:

Re: Why PHP programmers aren't considered real programmers

Post by Starglider »

Most programming involves discrete maths; boolean logic, set theory, graph theory. You only need calculus for some heavy data processing work; usually physical simulations and statistical data mining. 3D and data compression use a lot of matrix maths, but the vast majority of programming (done worldwidr) is simple sequencing logic, copying things around between I/O sources, and creating pretty GUIs. None of that needs a lot of maths.

Of course there is the question of whether you want to be able to program, or whether you want to be a really good programmer. Just like playing a musical instrument or any similar skill, most people can achieve a basic proficiency with a few months of effort, but it takes a natural aptitude and many, many years of practice to master.
Wing Commander MAD
Jedi Knight
Posts: 665
Joined: 2005-05-22 10:10pm
Location: Western Pennsylvania

Re: Why PHP programmers aren't considered real programmers

Post by Wing Commander MAD »

phongn wrote:
Jeremy wrote:
phongn wrote:But - as a quick-and-dirty gauge: how good are you at logic, reasoning and mathematics?
Below average I assume since I had to take DifEq twice. I didn't even like math until I took Calculus and then discovered it was enjoyable. Shamefully enough that is where I finally grasped algebra also.
Well, that's not quite a good sign but there are a lot of programmers who aren't so hot at maths, either. Take the course and see how it goes. If you keep banging your head against the wall and it doesn't "click" - stop.

What university are you going to?
I can attest to the math bit :oops:, lord knows I struggled with some of the more conceptual courses(curse you American Public Education System) and I still HATE/LOATHE proofs, but I'd say like the others try it and see what you think. What are you majoring in, ie is this as an elective, a requirment (where I went engineers were required to take basic introductory programming classes), or the basis of a career (Comp. Science)?
User avatar
Ariphaos
Jedi Council Member
Posts: 1739
Joined: 2005-10-21 02:48am
Location: Twin Cities, MN, USA
Contact:

Re: Why PHP programmers aren't considered real programmers

Post by Ariphaos »

If you have a multisite setup it may be far saner for you to insert the necessary database statements directly. Something a lot of web developers tend to forget is that applications call the database. There's a reason it has its own simplified language for access, and in general, you should take advantage of that after getting familiar with the schema.

PHP's lack of enforced structure or consistency is a serious pain, yes.
Give fire to a man, and he will be warm for a day.
Set him on fire, and he will be warm for life.
User avatar
Jeremy
Jedi Master
Posts: 1132
Joined: 2003-04-30 06:47pm
Location: Hyrule

Re: Why PHP programmers aren't considered real programmers

Post by Jeremy »

I am going to the University of North Florida in Jacksonville attempting my first Bachelor's Degree. My major is in Mechanical Engineering. I've taken Cal 1-3 w/Analytical Geometry, DifEq, Chem1&2, Gen Bio1, and Physics 1&2.

It is a required course but depending on how much I enjoy my Circuit Analysis class, I might switch to EE.
• Only the dead have seen the end of war.
• "The only really bright side to come out of all this has to be Dino-rides in Hell." ~ Ilya Muromets
User avatar
Ariphaos
Jedi Council Member
Posts: 1739
Joined: 2005-10-21 02:48am
Location: Twin Cities, MN, USA
Contact:

Re: Why PHP programmers aren't considered real programmers

Post by Ariphaos »

Destructionator XIII wrote:

Code: Select all

SELECT * FROM wp_usermeta WHERE user_id = 1;
+----------+---------+-------------------------+---------------------------------+
| umeta_id | user_id | meta_key                | meta_value                      |
+----------+---------+-------------------------+---------------------------------+
|        1 |       1 | nickname                | admin                           |
|        2 |       1 | rich_editing            | true                            |
|        3 |       1 | comment_shortcuts       | false                           |
|        4 |       1 | admin_color             | fresh                           |
|        8 |       1 | wp_1_capabilities       | a:1:{s:13:"administrator";b:1;} |
|        9 |       1 | wp_1_user_level         | 10                              |
+----------+---------+-------------------------+---------------------------------+
(I cut a few out)

Take a look at #8 there. What. The. Fuck. Is. That. (This is also Wordpress- multi user which is so fucking retarded that it duplicates a bunch of tables for each user rather than doing the sane thing and adding a blog_id or something).
It's what you get when you serialize an array in php. The user level is Wordpress's idea of ACL handling, but you probably already know that and that's an entirely different rant.

But - when you work with many php applications - that's the trap you're in. Drupal is somewhat nicer, in that it's written by more technically competent people. On the converse, technical competence tends to imply graphic/ui design incompetence, so uptake has been difficult.
Give fire to a man, and he will be warm for a day.
Set him on fire, and he will be warm for life.
User avatar
Starglider
Miles Dyson
Posts: 8709
Joined: 2007-04-05 09:44pm
Location: Isle of Dogs
Contact:

Re: Why PHP programmers aren't considered real programmers

Post by Starglider »

phongn wrote:PHP.net's documentation is not "good".
Seconded. I can't imagine why people think it is. Maybe because the comments contain lots of subtly or obviously flawed 'how to' recipies from people with two months programming experience?

The Java standard library documentation is excellent; very thorough, very detailed. The .NET standard library, DirectX and even MFC documentation is somewhat less thorough but still pretty solid (and has more inline how-tos). Last time I looked at it (which was a couple of years back) the PHP documentation was an amateurish joke by comparison. For some reason people think that junky web apps must be build with a junky POS language.
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Re: Why PHP programmers aren't considered real programmers

Post by phongn »

Destructionator XIII wrote:If the database is well designed, things are generally simple and I prefer to access it directly when possible. But that rarely happens when the designer has all the skill of a PHP programmer. (MySQL sucks in a lot of ways too, but that's a separate and lesser issue.)

Naturally, the WordPress posts tables (yes, tables, and I don't mean like you'd expect from a normalized layout) are fucked up the ass too. If it was just INSERT INTO some fields that made sense, I'd be a happy dude.
Not to defend WP's craziness (I'd need a more careful look at its database schema than just a few diagrams) but sometimes properly-normalization is not the way to go.
User avatar
Jeremy
Jedi Master
Posts: 1132
Joined: 2003-04-30 06:47pm
Location: Hyrule

Re: Why PHP programmers aren't considered real programmers

Post by Jeremy »

My apologies for the necromancy but it works--somehow.

My "Hello World".

Code: Select all

#include <stdio.h>
int main (void)
{
  printf("ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn\n");
  return 0;
} // main
• Only the dead have seen the end of war.
• "The only really bright side to come out of all this has to be Dino-rides in Hell." ~ Ilya Muromets
Post Reply