| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |
|
$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
|
|
Guru and php is pretty much an oxymoron isnt it?
|
|
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)
|
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. |
|
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
|
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
|
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)
|
'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
|
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. |
|
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)
|
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! |
|
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)
|
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
|
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
|
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 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)
|
|
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)
|
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)
|
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)
|
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. |
|
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
|
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) |
|
This comment is brilliant, you know!
|
|
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)
|
You truly are a comment guru. |
Re: Can You Say Your $a, $b, $c's?
2009-05-04 10:32
•
by
A Gould
(unregistered)
|
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)
|
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)
|
|
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)
|
|
...
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:41
•
by
bugmenot1
|
|
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
|
Re: Can You Say Your $a, $b, $c's?
2009-05-04 10:52
•
by
OldCoder
(unregistered)
|
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... |
|
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
|
Well put. But what about the great washed masses? Let's not be exclusionary. |
|
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)
|
/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
|
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)
|
Ok... and the problem is... ? |
|
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)
|
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
|
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
|
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. |
|
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)
|
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)
|
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
|
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)
|
Hey, are you also satanicpuppy on /. ? |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |