Comment On Can You Say Your $a, $b, $c's?

For as long as he could remember, one Millan C's clients had always bragged about having their very own, in-house PHP Guru. "You could really learn something from this guy," they would often tell him, "he's brilliant, you know! And a guru!" Not being a particularly big fan of PHP, nor really interested in meeting the guru, Millan always put it off for "some day." [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4Next »

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:04 • by Masm (unregistered)
$f.$i.$r.$s.$t.'?'

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:07 • by Ben Jammin (unregistered)
Every guru knows about job security

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:10 • by DiverKas (unregistered)
Guru and php is pretty much an oxymoron isnt it?

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:12 • by ObiWayneKenobi
And this is why anyone who calls themselves a "guru" should be fired immediately. Nevermind that all of these stories that feature a so-called guru in Language X always ends up with the person writing shitty code.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:16 • by Buddy (unregistered)
259472 in reply to 259468
DiverKas:
Guru and php is pretty much an oxymoron isnt it?
Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE but (bool)'false', (bool)'no', (bool)'0.0' to TRUE, you know you're in for a world of hurt.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:24 • by NoXzema (unregistered)
I hope I don't get like that someday... :/

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:25 • by Kazan
259475 in reply to 259472
Buddy:
DiverKas:
Guru and php is pretty much an oxymoron isnt it?
Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE but (bool)'false', (bool)'no', (bool)'0.0' to TRUE, you know you're in for a world of hurt.


or you could simply not be a jackass and realize that any-non-zero value is considered true and a non-empty string is considered non-zero.

and then you could be even less of a dumb ass by realizing that you're trying to say the language is bad by demonstrating a misuse of the language

and then you could continue by realizing that most dynamically typed languages would behave the same

then you could look up the === operator (yes three ='s) in PHP

oh but i forgot.... it's the in thing here to bash PHP since it's the competitor to C# ASP/.NET.

PS: PHP isn't a bad language, it's however an EASY language - easy languages get a higher proportion of bad programmers.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:28 • by pjt33
259477 in reply to 259475
Kazan:
Buddy:
When a language evaluates (bool)'0', (bool)'' to FALSE but (bool)'false', (bool)'no', (bool)'0.0' to TRUE, you know you're in for a world of hurt.

and then you could continue by realizing that most dynamically typed languages would behave the same

I think he did realise that, but I'll leave it to someone else to really kick off the static vs dynamic typing flame war.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:28 • by Buddy (unregistered)
259478 in reply to 259475
Kazan:
Buddy:
Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE ...


or you could simply not be a jackass and realize that any-non-zero value is considered true and a non-empty string is considered non-zero.
...


'0' is a non-empty string, (bool)'0' evaluates to FALSE.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:30 • by Kazan
259479 in reply to 259478
Buddy:
Kazan:
Buddy:
Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE ...


or you could simply not be a jackass and realize that any-non-zero value is considered true and a non-empty string is considered non-zero.
...


'0' is a non-empty string, (bool)'0' evaluates to FALSE.


it also is the numeric value zero... a string which is comprised of only decimal digits is considered a number for all intents and purposes. it's a weakly typed language, get over it.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:30 • by morry (unregistered)
Way to confirm the irreplaceability of the guru.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:30 • by Buddy (unregistered)
259481 in reply to 259478
Buddy:
Kazan:
Buddy:
Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE ...


or you could simply not be a jackass and realize that any-non-zero value is considered true and a non-empty string is considered non-zero.
...


'0' is a non-empty string, (bool)'0' evaluates to FALSE.
Before, I get stomped on, I understand it's technically empty according to PHP is_empty, but everywhere else, '0' is not an empty string!

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:31 • by OldHand (unregistered)
I have the feeling I once had this deja vu experience of seeing some similar code...

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:31 • by Mike (unregistered)
259483 in reply to 259478
Buddy:
Kazan:
Buddy:
Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE ...


or you could simply not be a jackass and realize that any-non-zero value is considered true and a non-empty string is considered non-zero.
...


'0' is a non-empty string, (bool)'0' evaluates to FALSE.


Yes, '0' is non-empty; however, it is not non-zero.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:33 • by Kazan
259484 in reply to 259483
Mike:
Buddy:
Kazan:
Buddy:
Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE ...


or you could simply not be a jackass and realize that any-non-zero value is considered true and a non-empty string is considered non-zero.
...


'0' is a non-empty string, (bool)'0' evaluates to FALSE.


Yes, '0' is non-empty; however, it is not non-zero.


he was pouncing on my generalize of non-empty strings being considered non-zero... because i simply didn't add "unless its contents are the number zero"

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:35 • by jonnyq
259485 in reply to 259475
Kazan:
Buddy:
DiverKas:
Guru and php is pretty much an oxymoron isnt it?
Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE but (bool)'false', (bool)'no', (bool)'0.0' to TRUE, you know you're in for a world of hurt.
PS: PHP isn't a bad language, it's however an EASY language - easy languages get a higher proportion of bad programmers.


As someone whose main qualification is PHP, I can say that PHP is a bad language. It's a very bad language that can be written well if you try hard enough.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:37 • by Patrick (unregistered)
I once knew a programmer who would swear by his practice of prefixing all function names with A, B, C, depending on the order in which they executed in their main thread. If they called functions of their own, those would be named AA, AB, AC, BA, BB, BC, etc...

And if both A_Something and B_Other called a common function, you would end up with AA_BA_Helper. Or AA_Helper and BA_Helper both calling _SHARED_Helper.

Sometimes profanity would be spelled out in the prefixes (totally inadvertently, of course), and the function names also had a habit of not being particularly descriptive. Like Go, Do, Run, Filter, etc...

Of course, other programmers knew the stupidity of this system and ignored the prefixes, creating functions with identical names (just without the prefixes) or not adding extra prefixes to functions called by many. It was a nightmare of backtracking. By the time I got to it, I spent most of my time deleting duplicates and renaming everything. I actually doubled the speed of the application without changing a single line of 'meat' code.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:40 • by JayC (unregistered)
259488 in reply to 259478
Yup, that about covers all cases. Javascript's the same way. Annoying, yes, but it's not that hard to figure out... granted, anybody who is using a string value in a boolean context and NOT trying to implement some obfuscatedfullery ought to be... I don't know, <INSERT BAD HAPPENSTANCE HERE>.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:42 • by ClaudeSuck.de (unregistered)
259489 in reply to 259475
Kazan:
Buddy:
DiverKas:
Guru and php is pretty much an oxymoron isnt it?
Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE but (bool)'false', (bool)'no', (bool)'0.0' to TRUE, you know you're in for a world of hurt.


or you could simply not be a jackass and realize that any-non-zero value is considered true and a non-empty string is considered non-zero.

and then you could be even less of a dumb ass by realizing that you're trying to say the language is bad by demonstrating a misuse of the language

and then you could continue by realizing that most dynamically typed languages would behave the same

then you could look up the === operator (yes three ='s) in PHP

oh but i forgot.... it's the in thing here to bash PHP since it's the competitor to C# ASP/.NET.

PS: PHP isn't a bad language, it's however an EASY language - easy languages get a higher proportion of bad programmers.


The Real WTF is PHP for their stupid boolean evaluation, Ha! QED

Re: Can You Say Your $a, $b, $c's?

2009-05-04 09:52 • by Blitz (unregistered)
259490 in reply to 259488
JayC:
Yup, that about covers all cases. Javascript's the same way. Annoying, yes, but it's not that hard to figure out... granted, anybody who is using a string value in a boolean context and NOT trying to implement some obfuscatedfullery ought to be... I don't know, <INSERT BAD HAPPENSTANCE HERE>.


Javascript is an interesting language that gives you enough room to really screw it up, but provides some useful features that make writing potentially complicated webapps a snap. Alternatively, you could use Objective-J, which makes Javascript behave more like Objective-C - if you can tolerate that many f***ing square brackets.

Also, I think you typoed "SELECT * FROM bad_happenstances LIMIT 0,1"

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:00 • by Procedural (unregistered)
259491 in reply to 259485
jonnyq:
Kazan:
Buddy:
DiverKas:
Guru and php is pretty much an oxymoron isnt it?
Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE but (bool)'false', (bool)'no', (bool)'0.0' to TRUE, you know you're in for a world of hurt.
PS: PHP isn't a bad language, it's however an EASY language - easy languages get a higher proportion of bad programmers.


As someone whose main qualification is PHP, I can say that PHP is a bad language. It's a very bad language that can be written well if you try hard enough.



I'm always impressed by the fact that people who say that PHP is a bad language, for it promotes odd inconvenient structures, is full of exceptions and incoherent rules, can be so readily abused, and therefore would and should be unpopular if it weren't for the great unwashed masses always choose to state those facts in English.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:06 • by Osno (unregistered)
Better:

function happenstance($a, $b, $c)
{
"Select" .$a. " FROM " .$b. " " .$c;
}

happenstance('f_name', 't_happenstances', 'LIMIT 0,1');

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:09 • by Kazan
259495 in reply to 259485
jonnyq:

As someone whose main qualification is PHP, I can say that PHP is a bad language. It's a very bad language that can be written well if you try hard enough.


my main qualification is C++, i have written a lot of php code and was paid to write LAMP eCommerce apps for 18 months.. only thing i couldn't find a good solution for is the Call Super, which C++ also lacks a good solution to (hence I avoid anything useful that could come from a solution to call super)

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:21 • by Charles400
This comment is brilliant, you know!

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:28 • by Herby (unregistered)
This is a primary example of "Job Security", or "Ease of understandability (well documented)". Looks like you only get to pick one.

A true "guru" will have both, and will not be self described.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:28 • by Neil (unregistered)
259501 in reply to 259498
Charles400:
This comment is brilliant, you know!

You truly are a comment guru.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:32 • by A Gould (unregistered)
259503 in reply to 259469
ObiWayneKenobi:
And this is why anyone who calls themselves a "guru" should be fired immediately. Nevermind that all of these stories that feature a so-called guru in Language X always ends up with the person writing shitty code.


Quoted for truth.

Titles like "elite" and "guru" are given, not taken. If other people aren't calling you The Man, you aren't (or at least, aren't yet).

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:34 • by Trevel (unregistered)
259504 in reply to 259469
Nevermind that all of these stories that feature a so-called guru in Language X always ends up with the person writing shitty code.


Uh, dude? Check what site you're on -- ALL the stories here end up with people writing shitty code. (Or some sort of hardware/management failure.) If you heard that some guy was a code guru in Language X and checked his functions and they were awesome, your story would not be told here. You'll have to go to AwesomeCodeStoriesForAwesomeCodeGurus.com to find that sort of story. Or more likely you'll find a DNS error (or if your ISP is evil, a search page -- which ought to be punishable by death)

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:38 • by joe (unregistered)
259505 in reply to 259491
And if that's how you write English, I'm glad I've never run into your code.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:40 • by joe (unregistered)
259506 in reply to 259505
...
I'm always impressed by the fact that people who say that PHP is a bad language, for it promotes odd inconvenient structures, is full of exceptions and incoherent rules, can be so readily abused, and therefore would and should be unpopular if it weren't for the great unwashed masses always choose to state those facts in English.
...

And if that's how you write English, I'm glad I've never run into your code.

Stupid Muphry's Law.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:40 • by strictnein
Yes yes. PHP clearly sucks. That's why no major sites use it.

Or is it just that it's easy to get started with and thus we end up with lots of bad PHP code?

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:41 • by bugmenot1
259510 in reply to 259504
But it doesn't have to be the guru writing shitty code, it could be someone else in the story

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:43 • by my name is missing (unregistered)
An expert is anyone 40 miles from home. A guru is anyone you wish was 40 miles away.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:45 • by Kazan
259512 in reply to 259507
strictnein:
Yes yes. PHP clearly sucks. That's why no major sites use it.

Or is it just that it's easy to get started with and thus we end up with lots of bad PHP code?


that's exactly it - PHP is easy to learn.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:52 • by OldCoder (unregistered)
259513 in reply to 259486
Patrick:
I once knew a programmer who would swear by his practice of prefixing all function names with A, B, C, depending on the order in which they executed in their main thread. If they called functions of their own, those would be named AA, AB, AC, BA, BB, BC, etc...

And if both A_Something and B_Other called a common function, you would end up with AA_BA_Helper. Or AA_Helper and BA_Helper both calling _SHARED_Helper.


This sounds like an old COBOL practice to me. I worked in a shop where 'goto considered harmful' so everything got performed...

A-MAIN performed B_INITIALIZE, C-LOOP and D-TERMINATE and so on down to lower levels. We always seemed to end up with a paragraph called GAY-ABANDON, innocent days.

Captcha: genitus. I'm almost afraid to ask...

Why all the PHP hate?

2009-05-04 10:54 • by anonymous_coder() (unregistered)
You know, I've never understood the PHP-bashing. As an experiment, we wrote the same simple web app in Tomcat/Java, Python, and PHP. It took two weeks in Python - mostly fighting with the flash front-end. It took two days in PHP. And it took 5 days in Java.

Frankly, crying about the language just means you lost your juicy contract to someone who undercut you on a web project proposal. I would never use PHP for anything other than web coding, but it excels at simple web applications.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:54 • by Code Dependent
259517 in reply to 259491
Procedural:
I'm always impressed by the fact that people who say that PHP is a bad language, for it promotes odd inconvenient structures, is full of exceptions and incoherent rules, can be so readily abused, and therefore would and should be unpopular if it weren't for the great unwashed masses always choose to state those facts in English.
Well put. But what about the great washed masses? Let's not be exclusionary.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 10:59 • by MrsPost
Ah, the old "I know what it means so it will always be good" syndrome. Not quite as bad as spaghetti code but pretty darn close.

I've had the dubious pleasure of re-writing a bunch of procedures as we upgrade and have had to deal with half a dozen temp tables at a time, each with a primary key field name of .. id.

I'd rant more but I'm the one who wrote them that way all those years ago. Now I can just shake my head and laugh. And be glad no one else has to deal with my stupidity.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 11:06 • by Adam (unregistered)
259520 in reply to 259506
joe:
...
I'm always impressed by the fact that people who say that PHP is a bad language, for it promotes odd inconvenient structures, is full of exceptions and incoherent rules, can be so readily abused, and therefore would and should be unpopular if it weren't for the great unwashed masses always choose to state those facts in English.
...

And if that's how you write English, I'm glad I've never run into your code.

Stupid Muphry's Law.


/me wipes tears of laughter from his eyes. Can you not see the "Quote" button? How about the "Preview" button?

Now, let us go to Wikipedia and learn of this man "Muphry"!

Re: Can You Say Your $a, $b, $c's?

2009-05-04 11:14 • by Code Dependent
259521 in reply to 259518
MrsPost:
I'd rant more but I'm the one who wrote them that way all those years ago.
How long have you worked at the same place, Mrs. Post? Say hi to the mister for me.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 11:21 • by Marcel (unregistered)
259522 in reply to 259518
MrsPost:
I've had the dubious pleasure of re-writing a bunch of procedures as we upgrade and have had to deal with half a dozen temp tables at a time, each with a primary key field name of .. id.


Ok... and the problem is... ?

Re: Can You Say Your $a, $b, $c's?

2009-05-04 11:25 • by Arantor (unregistered)
For those who bash PHP here, just note that this WTF could occur in just about *any* higher level language.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 11:35 • by jDeepbeep (unregistered)
259524 in reply to 259485
jonnyq:

As someone whose main qualification is PHP, I can say that PHP is a bad language. It's a very bad language that can be written well if you try hard enough.


Although it's not my only language, it is the most frequently encountered at the workplace on a daily basis, and... I must disagree with you saying 'it can be written well if you try hard enough'

Any person with formal training in writing code, problem solving, and logic, can write correct and reliable code in PHP. It's not about trying hard enough. It's about good habits, code clarity, and consistency.

Each language has its rough spots, so don't be a noob and imagine yourself above PHP. Fanbois < crackheads

Re: Can You Say Your $a, $b, $c's?

2009-05-04 11:40 • by snoofle
259525 in reply to 259512
Kazan:
that's exactly it - PHP is easy to learn.
I know not PHP, but it seems to me that PHP only appears to be easy to learn. Judging from the stories, learning to use it properly is not.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 11:42 • by Satanicpuppy
259527 in reply to 259523
Arantor:
For those who bash PHP here, just note that this WTF could occur in just about *any* higher level language.


It's the way PHP handles form data that causes these issues. Everything is dumped into a nice array (even though php has terrible arrays) and then you get to work with the data from there.

Most higher-level languages make you do specific stuff on the back-end to process the data.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 11:43 • by Jim Lard (unregistered)
Ouch. Glad I don't write my PHP like that! Everyone knows the proper way to do things is:

function evaluate($args)

Called like:

evaluate(array(
'arg1' => 5,
'arg2' => 'sheep',
'arg3' => 'wtf'
));

Re: Can You Say Your $a, $b, $c's?

2009-05-04 11:44 • by will (unregistered)
259529 in reply to 259525
snoofle:
Kazan:
that's exactly it - PHP is easy to learn.
I know not PHP, but it seems to me that PHP only appears to be easy to learn. Judging from the stories, learning to use it properly is not.

Like the saying goes. 10 minutes to learn a lifetime to master.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 11:44 • by jDeepbeep (unregistered)
259530 in reply to 259525
snoofle:
Judging from the stories, learning to use it properly is not.


I would say this is an incorrect conclusion. Because people shoot at other people with guns by accident, does not mean that this could not have been prevented/occurrences reduced by a brief 20 minute class on weapon safety. Of course, even if an individual took such a class, does not prevent them from shooting someone again. At this point in the story, I prefer strict typing in a language, and a ruthlessly critical compiler.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 11:46 • by erich
259531 in reply to 259504
Trevel:
Or more likely you'll find a DNS error (or if your ISP is evil, a search page -- which ought to be punishable by death)


Yeah, or at least severe forms of torture. public DNS FTW.

Re: Can You Say Your $a, $b, $c's?

2009-05-04 11:47 • by jDeepbeep (unregistered)
259532 in reply to 259527
Satanicpuppy:


Hey, are you also satanicpuppy on /. ?
« PrevPage 1 | Page 2 | Page 3 | Page 4Next »

Add Comment