The only supported version



  •  Found in an official Paypal API "constants" file:

    [code]/**
    # Version: this is the API version in the request.
    # It is a mandatory parameter for each API request.
    # The only supported value at this time is 2.3
    */

    define('VERSION', '54.0');[/code]

    I know, TRWTF is PHP.  Not relevant.



  • @Heron said:

     Found in an official Paypal API "constants" file:

    <font face="Lucida Console" size="2">/**
    # Version: this is the API version in the request.
    # It is a mandatory parameter for each API request.
    # The only supported value at this time is 2.3
    */

    define('VERSION', '54.0');</font>

    I know, TRWTF is PHP.  Not relevant.

    TRWTF is defining a global constant like "VERSION" and just assuming there won't be a namespace collision.  It's idiots like this that give PHP a bad name.



  • @morbiuswilters said:

    TRWTF is defining a global constant like "VERSION" and just assuming there won't be a namespace collision.  It's idiots like this that give PHP a bad name.

    That reminds me of this great article I found once.


    TL;DR: Guy tried to switch from PHP to Ruby on Rails for seven years, because someone told him it was better. But finally, he decided that he couldn't achieve planned things with Rails and simply switched back to PHP, where he applied all the good style and techniques he had learned and practiced in the process, finally resulting in a good PHP app.


    Conclusion: PHP isn't that bad, it just doesn't force you to write good code, thus often resulting in horrible, horrible abominations.



  • It's never the language. It's always the programmer.

    If a language has to force you to do anything, you are not a very good programmer.



  • There does, however, tend to be a correlation between the choice of language and the quality of programmer.  Languages with a reputation for being easy for beginners, like PHP and Visual Basic, tend to attract beginners, with a predictable effect on the quality of their communities.

    It is also a fact that Turing-equivalence does not mean that it is equally easy to write good code in any language.  Some languages and language communities actively encourage the writing of spaghetti monstrosities where the primary mechanism of code reuse is the clipboard.



  • @derula said:

    That reminds me of this great article I found once.
     

    The comments on that page are classic.  Over half of them were thinly-veiled paraphrasings of "NO UR WRONG IF U DONT LIKE RUBY THEN IT MUST HAVE BEEN UR FAULT!!!!!"

    Ruby is the new VB.  You heard it here first.



  • @derula said:

    That reminds me of this great article I found once.

    I like this bit:

    #7 - PROGRAMMING LANGUAGES ARE LIKE GIRLFRIENDS: THE NEW ONE IS BETTER BECAUSE *YOU* ARE BETTER
    Rails was an amazing teacher. I loved it’s “do exactly as I say” paint-by-numbers framework that taught me some great guidelines.
    I love Ruby for making me really understand OOP. God, Ruby is so beautiful. I love you, Ruby.
    But the main reason that any programmer learning any new language thinks the new language is SO much better than the old one is because he’s a better programmer now! You look back at your old ugly PHP code, compared to your new beautiful Ruby code, and think, “God that PHP is ugly!” But don’t forget you wrote that PHP years ago and are unfairly discriminating against it now.
    It’s not the language (entirely). It’s you, dude. You’re better now. Give yourself some credit.



  • @dhromed said:

    @derula said:

    That reminds me of this great article I found once.

    I like this bit:

    At some point in the article, I became confused as to wether he was in fact talking about a girlfriend or a programming language.  It was right about ... here

    God, Ruby is so beautiful. I love you, Ruby.

    And in the end he went back to his wife a better man for having had such a wonderful affair.  That's an apt summary of the article, right?



  • @belgariontheking said:

    At some point in the article, I became confused as to wether he was in fact talking about a girlfriend or a programming language.  It was right about ... here

    God, Ruby is so beautiful. I love you, Ruby.

    And in the end he went back to his wife a better man for having had such a wonderful affair.  That's an apt summary of the article, right?

     

    Yeah, pretty much.  Ruby was beautiful but also a psycho controlling bitch, so he went back to his stable ex (who at least knew her way around the kitchen) after getting her some plastic surgery and implants and teaching her a few new [ways to turn] tricks.  Ruby found some other desperate loser looking for a trophy wife/girlfriend and they all lived happily ever after.



  • @Aaron said:

    @derula said:

    That reminds me of this great article I found once.
     

    The comments on that page are classic.  Over half of them were thinly-veiled paraphrasings of "NO UR WRONG IF U DONT LIKE RUBY THEN IT MUST HAVE BEEN UR FAULT!!!!!"

    I thought the same thing.

    On a related note, several weeks ago I was working on a quick internal-use pastebin for developers here at my workplace.  I had a copy of someone else's BSD-licensed pastebin (which is now offline), which is written in PHP.  All I had to do was a quick run through the source code to fix up the pieces the original author had ripped out (mostly database connection stuff).  I expected it to take two or maybe three hours, if I worked slow.

    A coworker insisted that I use Ruby.  He spent near an hour describing the ease with which I could write the pastebin in Ruby.  When I asked whether there is a syntax highlighter available in Ruby, he shrugged and said "I'm sure there is."  (When he finally tracked one down hours later, it turned out to be a thin Ruby wrapper around a Python syntax highlighter, run via Ruby's equivalent of the "exec" command.)

    In the meantime, I finished my PHP rewrite (turned out to be easier to rewrite the UI and storage code than to patch it back up, but I kept the original syntax highlighter).  I'm fairly sure he still thinks it would have been "easier" to do it all in Ruby.  I'm not saying Ruby's worse than PHP, I'm just saying it's not the magical silver bullet that every Ruby fan I've ever met seems to think it is.



  • @The article said:

     Then in a mere TWO MONTHS, by myself, not even telling anyone I was doing this, using nothing but vi, and no frameworks, I rewrote CD Baby from scratch in PHP. Done! Launched! And it works amazingly well.

     

    Is he talking about CDBaby.com? If so, I call BS on this. No way you write something that complicated in 2 months without any frameworks. That's ridiculous.

    And why would you start a large project and not use a framework?? It just adds cost, time, and complexity to re-implement yourself, except now when you hire somebody to be the maintainer, they can't leverage their prior experience with Cake/Symfony/ZendFramework/etc and instead have to learn your idiosyncratic bullshit.



  • @savar said:

    @The article said:

     Then in a mere TWO MONTHS, by myself, not even telling anyone I was doing this, using nothing but vi, and no frameworks, I rewrote CD Baby from scratch in PHP. Done! Launched! And it works amazingly well.

     

    Is he talking about CDBaby.com? If so, I call BS on this. No way you write something that complicated in 2 months without any frameworks. That's ridiculous.

    And why would you start a large project and not use a framework?? It just adds cost, time, and complexity to re-implement yourself, except now when you hire somebody to be the maintainer, they can't leverage their prior experience with Cake/Symfony/ZendFramework/etc and instead have to learn your idiosyncratic bullshit.

     

    Maybe, maybe not:

    @The article said:

    Back in January 2005, I announced on the O’Reilly blog that I was going to completely scrap over 100,000 lines of messy PHP code in my existing CD Baby (cdbaby.com) website, and rewrite the entire thing in Rails, from scratch.

    CDBaby.com was already his site, so it's not like he was trying to clone somebody else's site.  I don't really buy the "from scratch" part though, unless "from scratch" now means "based on all the existing source code that I had, plus all the knowledge I had gained from developing the site the first time around."  Alternatively, "rewrote" might be code for "refactored heavily."



  • @savar said:

    Is he talking about CDBaby.com? If so, I call BS on this. No way you write something that complicated in 2 months without any frameworks. That's ridiculous.

    The article is two years old.  Most likely, features have been added since the original launch.

     

    @savar said:

    And why would you start a large project and not use a framework?? It just adds cost, time, and complexity to re-implement yourself, except now when you hire somebody to be the maintainer, they can't leverage their prior experience with Cake/Symfony/ZendFramework/etc and instead have to learn your idiosyncratic bullshit.

    Somewhat agree, somewhat don't.  A lot of the time, frameworks are over-complicated garbage that take longer to learn than just writing your own "mini-framework" and re-using code intelligently.  Another thing, there are so many frameworks out there for PHP that whatever one you pick you the maintenance programmer will probably have to learn it before he or she becomes effective.  Then you're relying on a third party for security updates and if the framework doesn't do something you want to do or it does it differently you have to spend gobs of time working around it.  ZendFramework is a perfect example of this: it's so monstrous and unwieldy that if you're trying to do anything more complicated than the tutorials you will spend much more time than if you just did it "from scratch".  On one project I spent a few months wrestling with ZF before dumping it and just writing my own libraries.



  • @Justice said:

    Alternatively, "rewrote" might be code for "refactored heavily."
     

    Especially given this quote from the article:

    @the article said:

    Instead, I was able to slowly gut the ugly PHP and replace it with beautiful PHP. Launch in stages.



  • @Heron said:

    I'm not saying Ruby's worse than PHP, I'm just saying it's not the magical silver bullet that every Ruby fan I've ever met seems to think it is.
    Then let me be the first to say that, as a Ruby fan and user, I am not so deluded.  Ruby's a tool like anything else.  It does some neat things, it does some lame things.  I'd pick it almost unconditionally over C++ or Java, but that's not saying much because I'd chose almost anything over them.  Ruby on Rails is nice provided you're desiging exactly the sort of web app that it was designed for; if you defy its conventions in any way, you are in for a heap of headaches.

    Also, it's not Ruby-specific, but Google code prettify is a decent client-side syntax highlighter.



  • @bstorer said:

    Also, it's not Ruby-specific, but Google code prettify is a decent client-side syntax highlighter.

    That looks interesting, thanks.


Log in to reply