- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I prefer languages, which will let you shoot yourself in the foot if you want to.
The problem is, that PHP is too easy to use. Maintaining such a mess after someone, that have "somehow" written the app is mind blowing...
Admin
And I always thought curiosity killed the $cat, when it actually was just pointing to another variable.
Admin
Well, you see, PHP utilises the latest Quantum Computing technologies, so the $cat variable can exist in a superposition of the scalar and array states.
Admin
I suppose
would do nothing but removed plausible deniability as to why the previous programmer's body parts has been stapled to bulletin board in the coffee room.
Admin
It's like http://forums.thedailywtf.com/forums/t/26141.aspx optimised to compress the WTF into (almost) the smallest possible code.
Admin
Admin
svn: command not found
Admin
But satisfaction brought 'em back!
Admin
So it's Schrödinger's $cat?
Admin
So it's Schrödinger's $cat?
(Quoted the wrong post before)
Admin
The less strongly-typed the language, the more important good unit testing is. This is a cornerstone of Agile development.
Admin
Admin
Admin
Having the power to shoot yourself in the foot by choice is one thing. A well-designed language, though, will make sure it's by choice -- in Clojure, for instance, if I want to mutate a variable (unsafe) rather than temporarily rebinding it (safe), I have to use a function with a with a ! on the end of its name, which marks it as "do this only if you're paying attention" -- and the scoping rules are very, very clear and explicit.
PHP, on the other hand... well, have you read the "fractal of bad design" essay?
Admin
Admin
What I want to know is if the reduction of $cat to a single entry is a necessary and intended effect or an unintended consequence. After a couple of years working there will you automatically recognize and use this pattern? I have at least one pattern I use repeatedly that has provoked amazement and revulsion in the uninitiated, but is too useful to give up.
Admin
Admin
Code documentation.
Admin
Right, I was wondering if this was 'clever programing' or a pure bug as well.
Admin
I expected that it loops only once and $cat is the first element of the array $cat.
Maybe the code is prehistoric (PHP 3 and older). The function array_pop was implemented in PHP 4.
Admin
File this WTF under '$catalogical'
Admin
hahah! awesome answer!
Admin
"And to make matters worse: it actually works"
in that case the real WTF is complaining about it.
Admin
What if you can't get no satisfaction?
Admin
In before everyone insists, without any rational reason or documentation, that PHP is a horrible mutant shitpile that deserves to be ridiculed, belittled, and exterminated.
(Maybe I've been reading TDWTF too long, but I'm kind of jaded on how PHP is the designated punching bag for languages around here.)
Admin
Nope, you haven't been here long enough because the designated punching bag is VB (either 6 or .net it doesn't seem to matter, though if somethignh is still in VB6 I would agree with them anyway)
Admin
It's quite simple to understand, m'kay? $cat is in scope outside the loop, and $cat is a local variable in scope only within the loop.
Got that?
Admin
I prefer comments, that don't use superfluous commas, to ones that do, because the latter, are difficult to read.
Admin
...but it is. Anyone who likes PHP is by definition a terrible developer.
Admin
So half of the front-end developers at Facebook then?
Admin
Ah, but when you measure the state of the wave-variable, you end up with either the scalar or the array state.
Thus leading to the Heisenbug uncertainty principle. Loosely stated, this means "you're screwed."
Admin
Only half?
Admin
Admin
Admin
Shit code is shit.
Admin
Until you have a feature request where you have to modify it, and this breaks a lot of stuff, causing hours or days of debugging.
Brittle code tends to shatter when touched.
Admin
Feel free to select your own language from that class and see if compares more favorably. I bet it won't. Incidentally, there aren't a lot of commonly-used, modern languages that fit in this class anymore. C++ is one of the better known ones.
Admin
Having worked quite a bit with the FB API and php I would say yes, most if not all the devs at Facebook are pretty terrible.
The one thing I can say for php, at least it isn't javascript. Now with html5 web devs are expected to make full scale web apps using js, a language that doesn't support file includes and object orientation only through a whole lot of syntactic sugar. And it has to run on many platforms with different implementations of js. Now QA and debugging time has multiplied by an order of 10. Makes me long for the days of Flash and Actionscript... say what you want about Flash, but at least AS3 is a real language and runs relatively the same across platforms. And furthermore, say what you want about the tenets of national socialism, dude, at least it's an ethos!
Admin
Indeed. Commas, which are misplaced, can actually change the meaning of the sentence.
Admin
Admin
Maybe the $cat has nine lives?
Admin
Had to test this. It really works as advertised.
Admin
Creative, but not as bad as the author thinks. Changing the projection, so to say.
Admin
The problem is that there are languages that give you the flexibility to make programs that are efficient and that do a wide variety of tasks, and there are languages that make it hard for you to shoot yourself in the foot. But the overlap between the two is very small.
Like: C: If it's possible to do it on the computer, you can probably do it with C. But you can hurt easily hurt yourself with a moment of carelessness. It's a high-speed powertool language.
COBOL: If it involves reading a file with fixed-length fields and printing a report, you may be able to do it with COBOL. But it's very difficult to hurt yourself. It's a child's plastic hammer language.
Admin
The policeman pulls Heisenberg over. "Do you know how fast you were going?" he demands.
"Honestly officer, I don't," Heisenberg answers. "But I know exactly where I am!"
Admin
Foreach isn't quite as simple one would think in php, try explaining this one: http://pastebin.com/m4fmWCPD
Admin
This ain't being entirely corect. Yes, true for major OS and some embeded system, but RTOS with most often be runing diferent, special system. it is great massage to be able to have compiler for almost all hardwares using C.
Admin
Is the submitter saying the loop works internally, but after that $cat is just the last element in the array? Seems like a twofer then.
Admin
You want buy cat?
Cat Very Fresh, Picked this morning. 1 Cat 50 MSK, Cat 75 MSK.
CAT NOT FOR SALE, good day sir.
Admin