Loose Cat Handling

  • Gandor 2012-06-11 10:10
    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...
  • the beholder 2012-06-11 10:14
    And I always thought curiosity killed the $cat, when it actually was just pointing to another variable.
  • GWO 2012-06-11 10:16
    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.
  • Code Slave 2012-06-11 10:17
    I suppose

    svn blame <file>

    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.
  • pjt33 2012-06-11 10:17
    It's like http://forums.thedailywtf.com/forums/t/26141.aspx optimised to compress the WTF into (almost) the smallest possible code.
  • Kasper 2012-06-11 10:18
    the beholder:
    I always thought curiosity killed the $cat
    Curiosity was framed, ignorance killed the cat.
  • PleegWat 2012-06-11 10:21
    Code Slave:
    I suppose

    svn blame <file>

    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.


    svn: command not found
  • Kaine 2012-06-11 10:28
    But satisfaction brought 'em back!
  • MightyM 2012-06-11 10:30
    the beholder:
    And I always thought curiosity killed the $cat, when it actually was just pointing to another variable.


    So it's Schrödinger's $cat?
  • MightyM 2012-06-11 10:31
    GWO:
    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.


    So it's Schrödinger's $cat?

    (Quoted the wrong post before)
  • Scrummy 2012-06-11 10:38
    The less strongly-typed the language, the more important good unit testing is. This is a cornerstone of Agile development.
  • Anon 2012-06-11 10:57
    MightyM:
    GWO:
    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.


    So it's Schrödinger's $cat?

    (Quoted the wrong post before)


  • $$ERR:get_name_fail 2012-06-11 10:59
    MightyM:
    So it's Schrödinger's $cat?

    You mean $schroedinger->cat?
  • Charles 2012-06-11 11:01
    Gandor:
    I prefer languages, which will let you shoot yourself in the foot if you want to.


    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?
  • Recursive Reclusive 2012-06-11 11:03
    Scrummy:
    The less strongly-typed the language, the more important good unit testing is. This is a cornerstone of Agile development.

    Does that have any relevance to the story?
  • Doug 2012-06-11 11:05
    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.
  • ntroutman 2012-06-11 11:10
    Doug:
    [...] 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.

    I might regret this, but I have to know; what is it?
  • TheSHEEEP 2012-06-11 11:17
    ntroutman:
    Doug:
    [...] 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.

    I might regret this, but I have to know; what is it?


    Code documentation.
  • Geoff 2012-06-11 11:23
    Right, I was wondering if this was 'clever programing' or a pure bug as well.
  • Tobias Rohde 2012-06-11 11:30
    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.
  • dogmatic 2012-06-11 11:56
    File this WTF under '$catalogical'
  • barf 4eva 2012-06-11 11:59
    hahah! awesome answer!
  • myName 2012-06-11 12:14
    "And to make matters worse: it actually works"

    in that case the real WTF is complaining about it.
  • Mason Wheeler 2012-06-11 12:22
    Kaine:
    But satisfaction brought 'em back!


    What if you can't get no satisfaction?
  • Jazz 2012-06-11 12:41
    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.)
  • KattMan 2012-06-11 12:50
    Jazz:
    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.)


    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)
  • Coyne 2012-06-11 12:52
    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?
  • operagost 2012-06-11 12:56
    I prefer comments, that don't use superfluous commas, to ones that do, because the latter, are difficult to read.
  • Leo 2012-06-11 13:08
    Jazz:
    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.


    ...but it is. Anyone who likes PHP is by definition a terrible developer.
  • BR 2012-06-11 13:46
    Leo:
    ...but it is. Anyone who likes PHP is by definition a terrible developer.


    So half of the front-end developers at Facebook then?
  • sfs 2012-06-11 13:52
    GWO:
    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.


    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."
  • M 2012-06-11 13:54
    BR:
    Leo:
    ...but it is. Anyone who likes PHP is by definition a terrible developer.


    So half of the front-end developers at Facebook then?


    Only half?
  • sfs 2012-06-11 13:55
    Gandor:
    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...

    ...right, because we all know that C++ programs have far fewer bugs than PHP programs...
  • DescentJS 2012-06-11 14:00
    sfs:
    Gandor:
    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...

    ...right, because we all know that C++ programs have far fewer bugs than PHP programs...

    Because, of course, there's no language other than C++ that he could have possibly meant. No other languages allow you to shoot yourself in the foot, No sir.
  • frits 2012-06-11 14:01
    Shit code is shit.
  • sfs 2012-06-11 14:01
    myName:
    "And to make matters worse: it actually works"

    in that case the real WTF is complaining about it.


    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.
  • sfs 2012-06-11 14:09
    DescentJS:
    sfs:
    Gandor:
    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...

    ...right, because we all know that C++ programs have far fewer bugs than PHP programs...

    Because, of course, there's no language other than C++ that he could have possibly meant. No other languages allow you to shoot yourself in the foot, No sir.

    The OP selected a class of languages: not easy, let you shoot yourself in the foot. I drew a language (C++) from that class to illustrate that the OP's point did not make a ton of sense.

    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.
  • dogmatic 2012-06-11 14:09
    BR:
    Leo:
    ...but it is. Anyone who likes PHP is by definition a terrible developer.


    So half of the front-end developers at Facebook then?


    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!
  • flyboyfred 2012-06-11 14:20
    operagost:
    I prefer comments, that don't use superfluous commas, to ones that do, because the latter, are difficult to read.


    Indeed. Commas, which are misplaced, can actually change the meaning of the sentence.
  • Jack 2012-06-11 14:32
    operagost:
    I prefer comments, that don't use superfluous commas, to ones that do, because the latter, are difficult to read.

    I prefer comments that have something to do with the story. Oops...
  • Mike 2012-06-11 14:32
    Maybe the $cat has nine lives?
  • uns 2012-06-11 14:35
    Had to test this. It really works as advertised.

    $ cat a.php
    <?php

    $a[] = "abc";
    $a[] = "def";

    var_dump($a);

    foreach ($a as $a) {
    echo "Element of a: $a\n";
    }

    var_dump($a);

    ?>
    $ php a.php
    array(2) {
    [0]=>
    string(3) "abc"
    [1]=>
    string(3) "def"
    }
    Element of a: abc
    Element of a: def
    string(3) "def"
    $
  • Vlad Patryshev 2012-06-11 14:52
    Creative, but not as bad as the author thinks. Changing the projection, so to say.
  • Jay 2012-06-11 14:53
    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.
  • Jay 2012-06-11 14:55
    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!"
  • henke37 2012-06-11 14:57
    Foreach isn't quite as simple one would think in php, try explaining this one:
    http://pastebin.com/m4fmWCPD
  • Nagesh 2012-06-11 15:00
    Jay:
    If it's possible to do it on the computer, you can probably do it with C.


    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.
  • I don't get it. 2012-06-11 15:01
    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.
  • Peppitoz 2012-06-11 15:01
    You want buy cat?

    Cat Very Fresh, Picked this morning.
    1 Cat 50 MSK, Cat 75 MSK.





    CAT NOT FOR SALE, good day sir.
  • foo 2012-06-11 15:15
    Jazz:
    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.
    s/before/after/;s/without/with/
    (see 382952 and read the essay it mentions)
  • thetiredsaint 2012-06-11 15:18
    This same thing works in Python.

    for cat in cat:
    


    Does exactly the same as the above PHP code.
  • yetihehe 2012-06-11 15:19
    henke37:
    Foreach isn't quite as simple one would think in php, try explaining this one:
    http://pastebin.com/m4fmWCPD
    You did in this pastebin's title. Foreach copies an array and iterates over this copy. So if you change array inside loop, it still iterates over old copy. This also explains why $cat still works, it's iterating over copy.
  • AGray 2012-06-11 15:21
    MightyM:
    the beholder:
    And I always thought curiosity killed the $cat, when it actually was just pointing to another variable.


    So it's Schrödinger's $cat?


    If you seal a $cat in $address, with a vial of $liquid, how do you observe to see if $cat is still allocated?

    CAPTCHA: nisl - a slightly nicer needle. No, that is not the answer to Schrodinger's $cat.
  • Nagesh 2012-06-11 15:22
    Also in Indian $cow is sacred $cat aint
  • Scrummy 2012-06-11 15:25
    Recursive Reclusive:
    Scrummy:
    The less strongly-typed the language, the more important good unit testing is. This is a cornerstone of Agile development.

    Does that have any relevance to the story?


    Apparently you skipped over the story, and headed right to the comments section.
  • Doug 2012-06-11 15:30
    A particular use of the macro processor in C and C++. It often happens that adding a new feature requires a predictable sequence of changes over a number of files. It is tedious to visit each file to make the changes, and hard to remember all the changes needed. I make an include file that has one feature per line, with all the feature's parameters wrapped in a macro call. I always name the macro MC (probably short for MaCro). Then throughout the code when I'm defining some aspect of these features, I redefine the macro MC and #include the file. This means I only have to add one line to one file to implement the feature (or the predictable parts of it anyway), I have all the other features in front of me, so it's easy to spot discrepancies, and I can be sure I updated all the proper spots. Looks like a crock, though, and IDE's don't always like it.

    For example, here are some lines from OpsMC.h

    MC(ADD,+,Add),
    MC(SUB,-,Sub),
    MC(MUL,*,Mul),

    OpTypes.h includes it to make an enum of ADD_OP, SUB_OP, etc and NUM_OPS

    #ifdef MC
    #undef MC
    #endif
    #define MC(type, symbol, text) type##_OP
    typedef enum {
    #include "OpsMC.h"
    NUM_OPS
    } Op;

    In a .C file three arrays are set up, which can be indexed by the enum above and will stay in synch when someone adds another operator.

    // The classifierSymbol and classifierText arrays are static to ClassifierOperation
    #ifdef MC
    #undef MC
    #endif
    #define MC(type, symbol, text) #symbol
    std::string ClassifierOperation::classifierSymbol[] =
    {
    #include "OpsMC.h"
    };
    #undef MC
    #define MC(type, symbol, text) #text
    std::string ClassifierOperation::classifierText[] =
    {
    #include "OpsMC.h"
    };
    #undef MC
    #define MC(type, symbol, text) #type
    std::string ClassifierOperation::classifierTypeName[] =
    {
    #include "OpsMC.h"
    };

    The payoff is greater in more complex situations. Sorry for the slow response, it took time to boil this down.
  • sfs 2012-06-11 15:47
    thetiredsaint:
    This same thing works in Python.

    for cat in cat:
    


    Does exactly the same as the above PHP code.

    Sure. There are a number of languages that allow you to play fast and loose with the scope of variable definitions. This doesn't mean that you should do it.

    The WTF wasn't "this is PHP." The WTF was "look what heinous thing someone did in PHP."
  • stew 2012-06-11 15:54
    So a professional programmer, claiming proficiency in a specific language, is hired to completely overhaul a code base written in that language.

    Said professional, when confronted with a simple control structure, is then mystified by that language's basic behavior.

    I think I spotted the WTF.
  • Jazz 2012-06-11 16:50
    Leo:
    Jazz:
    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.


    ...but it is. Anyone who likes PHP is by definition a terrible developer.


    And just as I predicted, you have no rational reason for that statement, or any documentation which suggests that it's true, even a little.

    It's like you're trying to prove me right.
  • Jazz 2012-06-11 17:00
    foo:
    Jazz:
    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.
    s/before/after/;s/without/with/
    (see 382952 and read the essay it mentions)


    Charles is not "everyone." Four words in quote marks are not "documentation," or even a decent citation. And the essay, which I went and googled at your request, is a poorly-supported opinion piece written by a developer who either can't or won't take the time to understand a language before criticizing it.

    His metaphor of PHP as a toolbox is a good one, but when he grabs a tool and it's not what he needs, he immediately jumps to "OMG PHP's tool X doesn't do Y!" when only two more seconds of searching would reveal that if he pulled the Y tool out of the box, it would do exactly what he needs.

    Sure, plenty of crap developers make pentagonal houses which fall apart when you knock on them using PHP. Plenty of good developers make flexible, secure websites with PHP, too, but you don't hear about them, because you like having PHP as the designated scapegoat to rag on.

    Either show me some documentation that isn't one person's closed-minded uneducated opinion rant, or shut the fuck up.
  • Matt Westwood 2012-06-11 17:26
    Jazz:
    foo:
    Jazz:
    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.
    s/before/after/;s/without/with/
    (see 382952 and read the essay it mentions)


    Charles is not "everyone." Four words in quote marks are not "documentation," or even a decent citation. And the essay, which I went and googled at your request, is a poorly-supported opinion piece written by a developer who either can't or won't take the time to understand a language before criticizing it.

    His metaphor of PHP as a toolbox is a good one, but when he grabs a tool and it's not what he needs, he immediately jumps to "OMG PHP's tool X doesn't do Y!" when only two more seconds of searching would reveal that if he pulled the Y tool out of the box, it would do exactly what he needs.

    Sure, plenty of crap developers make pentagonal houses which fall apart when you knock on them using PHP. Plenty of good developers make flexible, secure websites with PHP, too, but you don't hear about them, because you like having PHP as the designated scapegoat to rag on.

    Either show me some documentation that isn't one person's closed-minded uneducated opinion rant, or shut the fuck up.


    The real WTF is computer fucking programmers. Fuck off and die the lot of you cunts.
  • Recursive Reclusive 2012-06-11 17:27
    Scrummy:
    Recursive Reclusive:
    Scrummy:
    The less strongly-typed the language, the more important good unit testing is. This is a cornerstone of Agile development.

    Does that have any relevance to the story?


    Apparently you skipped over the story, and headed right to the comments section.

    Nope. Now answer the question.
  • anony-mouse 2012-06-11 17:32
    Jazz:
    foo:
    Jazz:
    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.
    s/before/after/;s/without/with/
    (see 382952 and read the essay it mentions)

    Sure, plenty of crap developers make pentagonal houses which fall apart when you knock on them using PHP. Plenty of good developers make flexible, secure websites with PHP, too, but you don't hear about them, because you like having PHP as the designated scapegoat to rag on.

    Either show me some documentation that isn't one person's closed-minded uneducated opinion rant, or shut the fuck up.

    Yeah, a good carpenter can make a good mouse with a rock instead of a hammer, but why would you?

    He doesn't complain about PHP not being able to do X or Y, he complains about the inconsistencies with the language and it's irrational, unpredictable naming convention for things.

    I also find it funny you call him close minded when you're the one screaming how good PHP is without being able to even acknowledge its obvious flaws.

    Stay pist, PHP guy.
  • George 2012-06-11 17:41
    Jay:
    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.
    When I wrote some COBOL code to do string manipulation (change LASTNAME, FIRSTNAME to Firstname Lastname) the old timers got the strangest looks on their faces. It was not merely that what I had done was impossible to do, it was even impossible to imagine.

    Of course that was way back then. Back before simply knowing COBOL meant I too, am an oldtimer! :(
  • David F. Skoll 2012-06-11 17:55
    Here's Perl:


    use Data::Dumper;
    my $cat = ['foo', 'bar', 'quux'];
    foreach $cat (@$cat) {
    print "$cat\n";
    }

    print Dumper($cat);


    And the results:


    $ perl cat.pl
    foo
    bar
    quux
    $VAR1 = [
    'foo',
    'bar',
    'quux'
    ];


    Arguably more "correct"?
  • Callin 2012-06-11 17:56
    Not enough possible variable names.

    Must use same name for many variables.
  • Spewin Coffee 2012-06-11 18:26
    You are giving too much credit to the authors of the code. The correct response is:

    'svn' is not recognized as an internal or external command,
    operable program or batch file.
  • Jack 2012-06-11 18:52
    Am I reading it wrong, or did the story imply that the for loops are hidden in include files?

    $cat = [1, 2, 3, 4, 5];
    
    #include("for_loop.php");
    echo $cat; // 5
  • PiisAWheeL 2012-06-11 19:05
    Jazz:
    foo:
    Jazz:
    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.
    s/before/after/;s/without/with/
    (see 382952 and read the essay it mentions)


    Charles is not "everyone." Four words in quote marks are not "documentation," or even a decent citation. And the essay, which I went and googled at your request, is a poorly-supported opinion piece written by a developer who either can't or won't take the time to understand a language before criticizing it.

    His metaphor of PHP as a toolbox is a good one, but when he grabs a tool and it's not what he needs, he immediately jumps to "OMG PHP's tool X doesn't do Y!" when only two more seconds of searching would reveal that if he pulled the Y tool out of the box, it would do exactly what he needs.

    Sure, plenty of crap developers make pentagonal houses which fall apart when you knock on them using PHP. Plenty of good developers make flexible, secure websites with PHP, too, but you don't hear about them, because you like having PHP as the designated scapegoat to rag on.

    Either show me some documentation that isn't one person's closed-minded uneducated opinion rant, or shut the fuck up.
    I hate php and i have been working with it for years. I still work with it because its what several of my clients want. I agree with a lot of the opinions in the essay as a result of personal experience. Everyday, not most days, but every single day I work with it, it always does something brand new to fuck with me. So no, its not documentation, but when enough people develop an opinion towards something, facts become less important. Its just a shitty language. Thats my opinion. That is a lot of peoples opinions. Its not closed minded, because it is a result of experience.
  • Muzer 2012-06-11 19:28
    Jack:
    Am I reading it wrong, or did the story imply that the for loops are hidden in include files?

    $cat = [1, 2, 3, 4, 5];
    
    #include("for_loop.php");
    echo $cat; // 5

    Certainly sounded like it implied that to me.
  • M 2012-06-11 19:34
    > cat fridge
    Error: cat cannot open fridge.

    Cracks me up every time.
  • Larry 2012-06-11 19:54
    M:
    > cat fridge
    Error: cat cannot open fridge.

    Cracks me up every time.
    You almost got it right...

    $ cat 'door: no hands'
    cat: cannot open door: no hands
  • RoadieRich 2012-06-11 20:32
    I want to hug every $cat, but I can't, because they've been overwritten.
  • Scrummy 2012-06-11 20:36
    Recursive Reclusive:
    Scrummy:
    Recursive Reclusive:
    Scrummy:
    The less strongly-typed the language, the more important good unit testing is. This is a cornerstone of Agile development.

    Does that have any relevance to the story?


    Apparently you skipped over the story, and headed right to the comments section.

    Nope. Now answer the question.


    The point that you are apparently not capable of comprehending is that a language like PHP is notoriously vulnerable to mysterious errors, because there is nothing to prevent scenarios like we see IN THIS STORY in advance of encountering it during runtime. With good unit testing this would be caught before it turned into a search akin to finding a needle in a haystack. For this reason, I would also go as far as to contend that PHP is a poor choice for Agile development.

    Do you see the relevance now? Or are you such a hyper-defensive PHP developer that you can't handle a civil discussion about the pros and cons of your beloved platform?
  • Kriis 2012-06-11 22:53
    I suppose

    svn blame <file>

    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.


    I hope I'm not the first to question your assumption that they have SVN that goes back that far...
  • blowhole 2012-06-11 23:02
    This isn't a big deal and that's just scripting languages for you. It should be obvious that it works that way. You should know that a lot of things in scripting languages work when you wouldn't expect coming from the background of a stricter language. Never expect things, read the documentation and experiment to find out how your language works. Turn on strict error reporting as well.

    I have seen far worse abominations in PHP, for example someone grossly misusing $$ and ${} (yes, that potentially allowed variable injection) to have a variable where the name is a number and the funny thing at the time is that the code was so simple it didn't even need an array. Passing the number in a normal variable was enough. I wondered at the time if someone made a typo of $$var instead of $var and rather than just correcting the typo, they changed the logic of the code to handle it everywhere else. I couldn't understand how someone could have been able to handle something so complex as the solution they created yet not be able to see the more obvious concise solution. That WTF blows nearly every PHP WTF I've seen here out of the water and it is only one of many such WTFs I've seen out there.

    Far worse is foreach($arr as &$ele).
  • Brendan 2012-06-11 23:37
    But what you don't know
    I'm gonna tell you right now
    That the stutter and the $cat is the same thing
    Yo, I'm the $cat man
    Where's the $cat man? I'm the $cat man.
  • Gibbon1 2012-06-12 00:05
    Scrummy:
    The less strongly-typed the language, the more important good unit testing is. This is a cornerstone of Agile development.


    Some people say PHP developers don't know Agile. This is wrong, they are very agile. If you've every some them flee to the next job before the codebase assplodes up you know what I mean.

    (In COBOL they use the waterfall model, or did. I mean it worked fine when they started the project back in 75. If they ever start another project they may well use it again)
  • Matt Westwood 2012-06-12 01:01
    blowhole:
    This isn't a big deal and that's just scripting languages for you. It should be obvious that it works that way. You should know that a lot of things in scripting languages work when you wouldn't expect coming from the background of a stricter language. Never expect things, read the documentation and experiment to find out how your language works. Turn on strict error reporting as well.

    I have seen far worse abominations in PHP, for example someone grossly misusing $$ and ${} (yes, that potentially allowed variable injection) to have a variable where the name is a number and the funny thing at the time is that the code was so simple it didn't even need an array. Passing the number in a normal variable was enough. I wondered at the time if someone made a typo of $$var instead of $var and rather than just correcting the typo, they changed the logic of the code to handle it everywhere else. I couldn't understand how someone could have been able to handle something so complex as the solution they created yet not be able to see the more obvious concise solution. That WTF blows nearly every PHP WTF I've seen here out of the water and it is only one of many such WTFs I've seen out there.

    Far worse is foreach($arr as &$ele).


    Probably got confused by the word "code" in "source code" and thought it meant something that you'd need an Enigma machine to make head or tail of. (Apologies for the misappropriation of terms and concepts for the purpose of comic effect.)
  • timok 2012-06-12 02:59
    dogmatic:
    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.


    Next time you bash a language, maybe learn a bit about it first. JavaScript is prototype based. If you try to write Java-like object-oriented code in it, you are doing it wrong. That's not a problem of the language. A screwdriver is not a bad tool just because someone insists on using it with nails.
    And if your web developers don't know how to write tests for their JavaScript, find better web developers. The tools exist and when combined properly and sticking to standards (and well-tested frameworks), you can have as much confidence in your JavaScript as in your server-side code.
  • corroded 2012-06-12 04:47
    Tobias Rohde:
    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.


    You mean exactly like the article says?
  • M 2012-06-12 05:50
    There's a difference between "likes" and "is prepared to use if paid well enough".
  • Dave 2012-06-12 05:51
    Coyne:
    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?


    Nope. PHP does not have arbitrary block scoping.
  • foxyshadis 2012-06-12 05:52
    Coyne:
    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?

    PHP doesn't work like you think it works, obviously. Scope is programmer-managed, not language-managed, which is a nice way of saying that there is no scope. (There is a completely separate global scope from function & class scope, but no block scopes. If you need that distinction, your code sucks.)

    However, the particular behavior mentioned in the WTF has been around and documented since the very beginning of the language. It's actually explicitly called out in the docs that when you manipulate anything in a foreach, the foreach continues to happily truck along as if nothing happened, whereas manipulating it in a for or while will immediately act upon your changes. It's a nuance of PHP but one that any PHP developer should be completely familiar with even if they never use it, because it's called out in a giant notice box of the farking foreach documentation that everyone has to read. Unless they're writing C in PHP, which is a WTF in itself.

    You can foreach your way out of a lot of bull if you love abusing code. I kind of lost my love of that quite a few years ago, though.

    All languages have cruft, some just revel in it more than others. Thankfully current PHP no longer even supports a lot of the long deprecated crap code, unfortunately that means most web hosts refuse to upgrade because their customers have so much crap code. Much like the Python 3 problem....

    /end rant
  • Dave 2012-06-12 05:55
    Scrummy:
    The point that you <meaningless gibberish snipped>


    You appear to be terminally hard-of-understanding. It has at no point been established that there is a bug in that code, or that it doesn't do exactly what the developer intended.

    How would your magic tests help here?
  • toshir0 2012-06-12 06:00
    Brendan:
    But what you don't know
    I'm gonna tell you right now
    That the stutter and the $cat is the same thing
    Yo, I'm the $cat man
    Where's the $cat man? I'm the $cat man.
    You obviously misread. No scat man involved.

    Maybe this could suit you better ?
  • Herr Otto Flick 2012-06-12 06:50
    Scrummy:
    The less strongly-typed the language, the more important good unit testing is. This is a cornerstone of Agile development.


    Unit testing only tests whether the code produces the correct results. It doesn't test whether the code is batshit insane, written by a 14 yr old who has been up for 3 days, or only working by happenstance.

    It is entirely plausible that code which passes unit tests is as bollocks as this code is.
  • mouse building pedant 2012-06-12 07:26
    anony-mouse:
    Jazz:
    foo:
    Jazz:
    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.
    s/before/after/;s/without/with/
    (see 382952 and read the essay it mentions)

    Sure, plenty of crap developers make pentagonal houses which fall apart when you knock on them using PHP. Plenty of good developers make flexible, secure websites with PHP, too, but you don't hear about them, because you like having PHP as the designated scapegoat to rag on.

    Either show me some documentation that isn't one person's closed-minded uneducated opinion rant, or shut the fuck up.

    Yeah, a good carpenter can make a good mouse with a rock instead of a hammer, but why would you?

    He doesn't complain about PHP not being able to do X or Y, he complains about the inconsistencies with the language and it's irrational, unpredictable naming convention for things.

    I also find it funny you call him close minded when you're the one screaming how good PHP is without being able to even acknowledge its obvious flaws.

    Stay pist, PHP guy.


    this modern learning astounds me ... explain again how a carpenter (good or otherwise) can make a good mouse with either a rock or a hammer?

    also ... can he make bad mice as well?

    anyway, presumably the $cat will be happy either way
  • Spudley 2012-06-12 07:45
    Everytime you iterate foreach($cat as $cat) a kitten dies.
  • syockit 2012-06-12 07:48
    Spudley:
    Everytime you iterate foreach($cat as $cat) a kitten dies.

    Actually only a kitten survives. The rest die.
  • Ritesh 2012-06-12 09:28
    You let the cat out of the bag!
  • Arclight 2012-06-12 09:48
    BR:
    Leo:
    ...but it is. Anyone who likes PHP is by definition a terrible developer.


    So half of the front-end developers at Facebook then?


    Well you are almost there. Not being a PHP developer doesnt infer that you are not a terrible developer. So your statement should have read "At least half ...".
  • M 2012-06-12 10:01
    Jazz:
    And the essay, which I went and googled at your request, is a poorly-supported opinion piece written by a developer who either can't or won't take the time to understand a language before criticizing it.

    His metaphor of PHP as a toolbox is a good one, but when he grabs a tool and it's not what he needs, he immediately jumps to "OMG PHP's tool X doesn't do Y!" when only two more seconds of searching would reveal that if he pulled the Y tool out of the box, it would do exactly what he needs.


    It's obvious you didn't read the essay, but just skimmed the start. If you had, then you would have seen there are lots of very specific examples. It is much more than a 'poorly-supported opinion piece' and it's clear he has spent time with the language.

    I know next to nothing about PHP, having written a grand total of one script using it. But I do know several other languages and am always interested in learning more, so I read the entire (very long) article. What I saw is just plain scary. For specifics, check out the sections on operators, variables, and error handling. If even half of what he wrote is true then PHP is definitely not for me. I prefer my languages' rational features to outnumber their WTF's by a decent ratio. That said, I probably will still try it out for myself at some point when I have the time, but I'm not optimistic.
  • jmacpherson 2012-06-12 10:08
    Funny to get this far and no reference to useless use of cat, so here it is, just so no one else will have to mention it. You're welcome!
  • PiisAWheeL 2012-06-12 10:23
    M:
    There's a difference between "likes" and "is prepared to use if paid well enough".
    +5. And I'm not even paid well enough :(
  • Caue 2012-06-12 10:27
    TRWTF is PHP
    specially PHP scoping
  • Jim 2012-06-12 11:04
    timok:
    when combined properly and sticking to standards (and well-tested frameworks), you can have as much confidence in your JavaScript as in your server-side code.
    Except that I can, and will, fuck with your JavaScript, because it runs on my computer, not yours. Keep that in mind as you code.
  • MadAdder 2012-06-12 11:18
    Say what you want about PHP and its developers, but at least PHP isn't a juxtaposition of tag-based markup and inline scripting interpreted by a program that is running on top of a Java Virtual Machine. Sure, there are a few more options for web-based development, but PHP provides the least barrier to entry. If that attracts more shoddy developers, so be it.
  • Mike 2012-06-12 11:20

    #ifdef MC

    #undef MC

    #endif

    #define MC(type, symbol, text) type##_OP

    typedef enum {

    #include "OpsMC.h"

    NUM_OPS

    } Op;

    (etc.)


    You won the unofficial dailywtf obfuscated C contest today. Congratulations!
  • pantsman 2012-06-12 11:32
    It's just sad when people defend PHP. Ignorance must be bliss.

    I used to hold the job title "Senior PHP Developer". Learning a proper programming language and looking for a new job was the best thing I ever did for my career.
  • Nagesh 2012-06-12 12:10
    Recursive Reclusive:
    Scrummy:
    The less strongly-typed the language, the more important good unit testing is. This is a cornerstone of Agile development.

    Does that have any relevance to the story?


    No but is called baiting on internet forums.
  • Mason Wheeler 2012-06-12 12:22
    Jay:
    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.


    You should look at Pascal. Just as powerful as C, light-years easier to read, and actually designed to make it difficult to shoot yourself in the foot.

  • Mason Wheeler 2012-06-12 12:23
    Herr Otto Flick:
    Scrummy:
    The less strongly-typed the language, the more important good unit testing is. This is a cornerstone of Agile development.


    Unit testing only tests whether the code produces the correct results. It doesn't test whether the code is batshit insane, written by a 14 yr old who has been up for 3 days, or only working by happenstance.

    It is entirely plausible that code which passes unit tests is as bollocks as this code is.


    Unit testing only tests whether the code produces the results expected by the unit test. Nothing more, nothing less. Remember, the unit tests are code too, and can contain bugs. (Carry that thought to its logical conclusion and you end up with turtles all the way down.)
  • anony-mouse 2012-06-12 12:49
    mouse building pedant:
    anony-mouse:
    Jazz:
    foo:
    Jazz:
    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.
    s/before/after/;s/without/with/
    (see 382952 and read the essay it mentions)

    Sure, plenty of crap developers make pentagonal houses which fall apart when you knock on them using PHP. Plenty of good developers make flexible, secure websites with PHP, too, but you don't hear about them, because you like having PHP as the designated scapegoat to rag on.

    Either show me some documentation that isn't one person's closed-minded uneducated opinion rant, or shut the fuck up.

    Yeah, a good carpenter can make a good mouse with a rock instead of a hammer, but why would you?

    He doesn't complain about PHP not being able to do X or Y, he complains about the inconsistencies with the language and it's irrational, unpredictable naming convention for things.

    I also find it funny you call him close minded when you're the one screaming how good PHP is without being able to even acknowledge its obvious flaws.

    Stay pist, PHP guy.


    this modern learning astounds me ... explain again how a carpenter (good or otherwise) can make a good mouse with either a rock or a hammer?

    also ... can he make bad mice as well?

    anyway, presumably the $cat will be happy either way

    that god damn m key, always sneaking up on me...
  • Remy Martin 2012-06-12 13:38
    Hey guys, unfortunately I have some really bad news.

    Last night, Alex OD'd on meth after spending 70 hours straight playing Call of Duty: Modern Warfare. He was discovered in his parents' basement at 4:00am this morning. Please keep his family in your prayers, as me and Mike try to determine the future of this site.
  • Ima Cougar 2012-06-12 14:37
    Remy Martin:
    Hey guys...
    There are guys here??!!! (Drool!)
  • Paul 2012-06-12 14:50
    BR:
    Leo:
    ...but it is. Anyone who likes PHP is by definition a terrible developer.


    So half of the front-end developers at Facebook then?


    Given how often FB seems to have weird and inexplicable problems crop up, I'm inclined to say a big "hell yes" to that.
  • Jay 2012-06-12 15:04
    thetiredsaint:
    This same thing works in Python.

    for cat in cat:
    


    Does exactly the same as the above PHP code.


    I see the error. It should be:


    for cat in hat:
  • fggr 2012-06-12 16:51
    PHP rocks. It's job security through being high while designing a language!
  • Christian 2012-06-13 03:56
    Kriis:
    I suppose

    svn blame <file>

    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.


    I hope I'm not the first to question your assumption that they have SVN that goes back that far...

    They don't. All of these little gems are hidden behind the first developer that made the commit number 1 with EVERYTHING in the code base. Who did that before this commit is a mystery. Chances are the person is long gone.
  • uns 2012-06-13 04:55
    fggr:
    PHP rocks. It's job security through being high while designing a language!


    I heard of a certain PHP core language developer who did just that (well, the "being high" part, anyway). This may be lore, but they seem to have seen the need for a "no commit while high" policy.
  • mercenary 2012-06-13 09:23
    "If it involves reading a file with fixed-length fields and printing a report, you may be able to do it with COBOL."

    Like running payrolls? It isn't as sexy as enabling college students to post pictures of their cats, heaven knows, but landlords, banks, grocery stores, etc. seem to be in favor of one's getting paid.

    CAPTCHA: dignissim, most worthy, if it included us.
  • frits 2012-06-13 10:12
    Remy Martin:
    Hey guys, unfortunately I have some really bad news.

    Last night, Alex OD'd on meth after spending 70 hours straight playing Call of Duty: Modern Warfare. He was discovered in his parents' basement at 4:00am this morning. Please keep his family in your prayers, as me and Mike try to determine the future of this site.
    Ha ha ha! What wit!
  • Jay 2012-06-13 12:23
    George:
    Jay:
    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.
    When I wrote some COBOL code to do string manipulation (change LASTNAME, FIRSTNAME to Firstname Lastname) the old timers got the strangest looks on their faces. It was not merely that what I had done was impossible to do, it was even impossible to imagine.

    Of course that was way back then. Back before simply knowing COBOL meant I too, am an oldtimer! :(


    Yes, I have fond memories of the time at my first IT job, back in 1980. At a meeting someone was describing how he thought a new system should work and he made a casual reference to reading the customer's name and searching for spaces to break it into first name and last name. And immediately half the programmers in the room protested that this was crazy and way too complicated and at this company we have fixed length fields with separate fields for first and last name. I was amused not just at the objection, but at how upset everyone obviously was about it. From the reaction it was like he had suggested they sell their daughters into prostitution or something.
  • Jay 2012-06-13 12:27
    mercenary:
    "If it involves reading a file with fixed-length fields and printing a report, you may be able to do it with COBOL."

    Like running payrolls? It isn't as sexy as enabling college students to post pictures of their cats, heaven knows, but landlords, banks, grocery stores, etc. seem to be in favor of one's getting paid.

    CAPTCHA: dignissim, most worthy, if it included us.


    I didn't say there's no use for such a language. I just pointed out the contrast. Indeed, a language that makes it hard for you to hurt yourself, even if it's capabilities are sharply limited, might well be the best choice for beginning students and less-skilled programmers.
  • sod 2012-06-13 13:10
    Remy Martin:
    Hey guys, unfortunately I have some really bad news.

    Last night, Alex OD'd on meth after spending 70 hours straight playing Call of Duty: Modern Warfare. He was discovered in his parents' basement at 4:00am this morning. Please keep his family in your prayers, as me and Mike try to determine the future of this site.


    This is the sort of post that makes me furious. You're ruining this site! For the love of everything holy, why can't ignoramuses such as yourself see that you should have written "Mike and I"?

    Captcha: saluto. I saluto your stupidity.
  • AN AMAZING CODER 2012-06-13 13:34
    dogmatic:
    BR:
    Leo:
    ...but it is. Anyone who likes PHP is by definition a terrible developer.


    So half of the front-end developers at Facebook then?


    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.


    Not only is the Facebook API not driven by PHP, but using the Facebook API with PHP has nothing to do with Facebook's view layer.

  • joao 2012-06-13 13:59
    sfs:
    Gandor:
    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...

    ...right, because we all know that C++ programs have far fewer bugs than PHP programs...


    After .a customer of mine had a serious application crash they commissioned an analysis from a 3rd party. The application was developed in house.
    To make a long story short, the "3rd" party blamed we network guys. The program was (original from Italian ) "ovviamente bugless " since it was written in VB. net. This is because. net runs into a sandbox, so bugs cannot exist.
    It was a stupid network fault not handling 50gb dataset transmitted by select * queries every less than 2 seconds.
    so trust our 3rd party: there are inherently bugless languages.
  • qbolec 2012-06-13 14:51

    convert it from single files with tons of includes

    wait, what?
  • nisl 2012-06-13 18:44
    Gandor:
    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...


    This is why people should switch to languages that are compiled (over being interpreted). PHP is the same WTF to me as classic ASP. I understand that, in the past, PHP was the best (or good) thing available, but starting a project nowadays at anything that isn't in the "compilable" category (.NET being pretty much the only good one) is just insane, and stupid (no offense).

    BTW, if somebody mentions that it's cheaper to host PHP - it's not (consider that, aside from the cost of OS, there's nothing that linux box can do that windows cannot, both quantity and quality wise). If somebody says, linux just performs better - wake the fuck up: that may have been the case in the past, but windows performs as good, if not better. Finally, for both of these cases, maintaining (including finding and paying developers) is harder and more expensive for the PHP/apache/unix choice.

    :)
  • wbrianwhite 2012-06-14 10:58
    dogmatic:
    BR:
    Leo:
    ...but it is. Anyone who likes PHP is by definition a terrible developer.


    So half of the front-end developers at Facebook then?


    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!


    You can use javascript to load other javascripts, which is effectively includes. And javascript is fully object-oriented. You can use frameworks like jquery or prototype to smooth over all the browser differences. You should know all this if you're working with html5 apps.
  • wbrianwhite 2012-06-14 11:09
    Herr Otto Flick:
    Scrummy:
    The less strongly-typed the language, the more important good unit testing is. This is a cornerstone of Agile development.


    Unit testing only tests whether the code produces the correct results. It doesn't test whether the code is batshit insane, written by a 14 yr old who has been up for 3 days, or only working by happenstance.

    It is entirely plausible that code which passes unit tests is as bollocks as this code is.


    Test driven development has no inherent problem with batshit insane code. Which is why it's fine as a development methodology, but isn't sufficient for a maintenance methodology.
  • wbrianwhite 2012-06-14 11:20
    nisl:
    Gandor:
    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...


    This is why people should switch to languages that are compiled (over being interpreted). PHP is the same WTF to me as classic ASP. I understand that, in the past, PHP was the best (or good) thing available, but starting a project nowadays at anything that isn't in the "compilable" category (.NET being pretty much the only good one) is just insane, and stupid (no offense).

    BTW, if somebody mentions that it's cheaper to host PHP - it's not (consider that, aside from the cost of OS, there's nothing that linux box can do that windows cannot, both quantity and quality wise). If somebody says, linux just performs better - wake the fuck up: that may have been the case in the past, but windows performs as good, if not better. Finally, for both of these cases, maintaining (including finding and paying developers) is harder and more expensive for the PHP/apache/unix choice.

    :)


    We run all our .Net out of app_code so it's compiled on the fly. Development is just so much faster if you just need to hit F5 to refresh instead of going to studio and compiling.

    Is classic ASP a crap design? Well MS just brought the design back with WebMatrix web pages -spaghetti code style mix of html tags and server side code.
  • Scrummy 2012-06-14 14:45
    wbrianwhite:
    Herr Otto Flick:
    Scrummy:
    The less strongly-typed the language, the more important good unit testing is. This is a cornerstone of Agile development.


    Unit testing only tests whether the code produces the correct results. It doesn't test whether the code is batshit insane, written by a 14 yr old who has been up for 3 days, or only working by happenstance.

    It is entirely plausible that code which passes unit tests is as bollocks as this code is.


    Test driven development has no inherent problem with batshit insane code. Which is why it's fine as a development methodology, but isn't sufficient for a maintenance methodology.


    But TDD does guard against outcomes that do not match business requirements. The $cat iterator was causing bad data to be returned, which would fail a test.
  • feugiat 2012-06-16 00:16
    wbrianwhite:
    nisl:
    Gandor:
    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...


    This is why people should switch to languages that are compiled (over being interpreted). PHP is the same WTF to me as classic ASP. I understand that, in the past, PHP was the best (or good) thing available, but starting a project nowadays at anything that isn't in the "compilable" category (.NET being pretty much the only good one) is just insane, and stupid (no offense).

    BTW, if somebody mentions that it's cheaper to host PHP - it's not (consider that, aside from the cost of OS, there's nothing that linux box can do that windows cannot, both quantity and quality wise). If somebody says, linux just performs better - wake the fuck up: that may have been the case in the past, but windows performs as good, if not better. Finally, for both of these cases, maintaining (including finding and paying developers) is harder and more expensive for the PHP/apache/unix choice.

    :)


    We run all our .Net out of app_code so it's compiled on the fly. Development is just so much faster if you just need to hit F5 to refresh instead of going to studio and compiling.

    Is classic ASP a crap design? Well MS just brought the design back with WebMatrix web pages -spaghetti code style mix of html tags and server side code.


    No sane .NET developer will even install anything but Visual Studio (and waste time for amateur tools such as Webmatrix) or compile code on the fly (MS realized that VS website-project was a mistake and it fixed it by creating web-project template).
  • dogmatic 2012-06-16 12:38
    wbrianwhite:

    You can use javascript to load other javascripts, which is effectively includes. And javascript is fully object-oriented. You can use frameworks like jquery or prototype to smooth over all the browser differences. You should know all this if you're working with html5 apps.


    I've been working with jquery and prototype for years. And I've used libraries like js require for includes. Jquery is great, but there are still plenty of cross browser compatibility issues that come up with it. Plus the fact that js runs at very different speeds depending on browser. I've made games with js and it is a debugging nightmare compared to something similar in flash. I even dabbled with Web os for a bit, which is really the only place you can be doing true html5 apps right now. Yes you can do html5 if you only plan to support a couple browsers, but for client work it still has to run on ie8, so no true html5. Web os was alright but compared to coding in Java for Android, still very much inferior. I guess I like my languages like my women... Strongly typed.
  • wbrianwhite 2012-06-16 14:49
    Scrummy:
    wbrianwhite:
    Herr Otto Flick:
    Scrummy:
    The less strongly-typed the language, the more important good unit testing is. This is a cornerstone of Agile development.


    Unit testing only tests whether the code produces the correct results. It doesn't test whether the code is batshit insane, written by a 14 yr old who has been up for 3 days, or only working by happenstance.

    It is entirely plausible that code which passes unit tests is as bollocks as this code is.


    Test driven development has no inherent problem with batshit insane code. Which is why it's fine as a development methodology, but isn't sufficient for a maintenance methodology.


    But TDD does guard against outcomes that do not match business requirements. The $cat iterator was causing bad data to be returned, which would fail a test.


    Where did it say that?

    Also, it's entirely possible you had a series of isolated unit tests which all passed, and only the integration failed
  • wbrianwhite 2012-06-16 14:52
    dogmatic:
    wbrianwhite:

    You can use javascript to load other javascripts, which is effectively includes. And javascript is fully object-oriented. You can use frameworks like jquery or prototype to smooth over all the browser differences. You should know all this if you're working with html5 apps.


    I've been working with jquery and prototype for years. And I've used libraries like js require for includes. Jquery is great, but there are still plenty of cross browser compatibility issues that come up with it. Plus the fact that js runs at very different speeds depending on browser. I've made games with js and it is a debugging nightmare compared to something similar in flash. I even dabbled with Web os for a bit, which is really the only place you can be doing true html5 apps right now. Yes you can do html5 if you only plan to support a couple browsers, but for client work it still has to run on ie8, so no true html5. Web os was alright but compared to coding in Java for Android, still very much inferior. I guess I like my languages like my women... Strongly typed.


    If you want to support every browser equally, I think your only safe bet is html 3.2.
  • wbrianwhite 2012-06-16 14:55
    feugiat:
    wbrianwhite:
    nisl:
    Gandor:
    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...


    This is why people should switch to languages that are compiled (over being interpreted). PHP is the same WTF to me as classic ASP. I understand that, in the past, PHP was the best (or good) thing available, but starting a project nowadays at anything that isn't in the "compilable" category (.NET being pretty much the only good one) is just insane, and stupid (no offense).

    BTW, if somebody mentions that it's cheaper to host PHP - it's not (consider that, aside from the cost of OS, there's nothing that linux box can do that windows cannot, both quantity and quality wise). If somebody says, linux just performs better - wake the fuck up: that may have been the case in the past, but windows performs as good, if not better. Finally, for both of these cases, maintaining (including finding and paying developers) is harder and more expensive for the PHP/apache/unix choice.

    :)


    We run all our .Net out of app_code so it's compiled on the fly. Development is just so much faster if you just need to hit F5 to refresh instead of going to studio and compiling.

    Is classic ASP a crap design? Well MS just brought the design back with WebMatrix web pages -spaghetti code style mix of html tags and server side code.


    No sane .NET developer will even install anything but Visual Studio (and waste time for amateur tools such as Webmatrix) or compile code on the fly (MS realized that VS website-project was a mistake and it fixed it by creating web-project template).


    I'm pretty sure that Microsoft developed Webmatrix, right? Probably created by a sane group of .Net developers. Personally WebMatrix and Razor is what I think the first version of ASP.Net should have been. WebForms was a long wander through the dark finally relieved by MVC, which is acceptable but complicated, or WebMatrix, which is also acceptable. What's wrong with compile on the fly? Views in MVC are all compile on the fly. Why not make the view models and controllers the same?
  • Nagesh 2012-06-18 12:19
    nisl:
    Gandor:
    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...


    This is why people should switch to languages that are compiled (over being interpreted). PHP is the same WTF to me as classic ASP. I understand that, in the past, PHP was the best (or good) thing available, but starting a project nowadays at anything that isn't in the "compilable" category (.NET being pretty much the only good one) is just insane, and stupid (no offense).

    BTW, if somebody mentions that it's cheaper to host PHP - it's not (consider that, aside from the cost of OS, there's nothing that linux box can do that windows cannot, both quantity and quality wise). If somebody says, linux just performs better - wake the fuck up: that may have been the case in the past, but windows performs as good, if not better. Finally, for both of these cases, maintaining (including finding and paying developers) is harder and more expensive for the PHP/apache/unix choice.

    :)


    You are surely making joke. Widows box doesn't perform as well as linux box. Sorry, you are total in wrong.
  • Shark8 2012-06-18 23:06
    Yes, yes they are.

    "Popularity" /= "competence"