back to article PHP victory over Ruby: was Gosling right?

Remember when Java father James Gosling got flamed for uttering the ultimate Web 2.0 heresy: scripting languages aren't good enough for enterprises? The world's second favourite Canadian was taken down a notch or two for the thought crime of "not getting it". A year and a half later, and a user case study has popped up that …

COMMENTS

This topic is closed for new posts.
  1. Jach

    PHP: Made for the web.

    I'm not a framework guy. I've given Rails and Python's Django a whirl, and honestly, I like regular PHP better--for the web.

    Python (and in many cases Ruby) is a very pretty language, and I enjoy coding in it more than others. But as far as web programming goes, I think PHP has the win. It's well-established, it's easy to get stuff done, and the syntax is easy enough that most people can start developing in a day without having to look through a big API for the framework.

    For me, PHP is best suited for the Web (PHP-GTK is cool, but not cool enough), and Python/Ruby is best suited for computer apps.

  2. James Eaglestar

    Missing something

    I'm probably missing something here but :

    1- I don't see how this story validates or invalidates Gosling's idea that "scripting languages aren't good enough for enterprises".

    Isn't PHP a scripting language also ?

    2- In my humble opinion, the issue here is whether a web-framework is the best solution for every aspect of web development. There are many php-based frameworks and there's no guarantee that any one of them would have faired better.

    This being said please that i do not use Ruby or Rails at all.

  3. Anonymous Coward
    Anonymous Coward

    "not even telling anyone I was doing this"

    I think that's the key to success, never tell anyone you're working on a project otherwise your motivation will quickly begin to deflate like a balloon.

  4. Anonymous Coward
    Anonymous Coward

    PHP is a scripting language

    Ruby is too slow (maybe that will change) PHP runs fast enough to do what he wanted all along so the Canadian wasn't right. It's ugly and makes you mad but PHP has the balls to run really big sites JAVA doesn't scale well either. It only takes a few minutes to figure out why C++ probably could handle it but it might be awhile before we find out and C can do it but the debugging of very subtle flaws takes too long and costs too much for large projects so that leaves ugly old PHP being the only game in town like it or lump it.

  5. Anonymous Coward
    Anonymous Coward

    I agree (with reservations)

    #2 - OUR ENTIRE COMPANY’S STUFF WAS IN PHP: DON’T UNDERESTIMATE INTEGRATION

    Valid point. I'm currently maintaining an intranet with bucketloads of spaghetti vbscript/asp; I would like to re-design/re-write the whole thing, but _it works_.

    The system can be incrementally improved, one chunk at a time, and there is budget for that, but no-one will fund a complete rewrite in a new framework because framework x is 'better'

    That said, the rules are different when designing a new site from scratch.

    #6 - I LOVE SQL

    I agree wholeheartedly. Especially with transactions.

    Adrian

  6. Finn Higgins

    PHP is a scripting language, Rails is a framework

    Should this author really be writing stories with such silly headlines given that they're seemingly unaware of what PHP, Ruby and Rails actually are?

    In this case, a project was started with dubious goals - to replace 100,000 lines of PHP (with a lot of hand-written SQL and a legacy database schema) with Ruby on Rails, a framework with fairly legendary workflow improvements built on the concept of convention over configuration. By the look of it he may even have been trying to migrate from MySQL to Postgres at the same time, just to really make sure he failed.

    Both Ruby and PHP are scripting languages. There's no real reason why you can't do anything in Ruby you can do in PHP, the only real differences are performance and available existing frameworks. Ruby is arguably a nicer language once you know it, given PHP is an ugly piece of shit.

    But essentially here the issue is that this guy started writing a project in a language he didn't know, on a framework he hadn't properly evaluated against his needs, and was intending to replace hundreds of thousands of lines of core business systems in a single roll-out. This seems foolhardy in the extreme.

    Then when he pulled the plug he didn't go back to PHP and start again with a new PHP-based framework comparable to Rails - he threw out the idea of a framework entirely and wrote his own. There's no reason he couldn't have done that in Ruby just as effectively, but he went back to what he was familiar with.

    This has nothing to do with Gosling's comments and nothing to do with a victory for PHP over Ruby unless you consider familiarity of one particular developer a victory.

    A stupid headline? Never...

  7. E

    Who's the first favourite Canadian?

    <elipsis>

  8. E

    Frameworks

    ... are usually more trouble to learn than they are worth.

    You got the Java way: 5e3954 classes & methods.

    You got the Ruby way: maybe 3e4321 classes & methods.

    You got the Python way: actually I gave up at that point.

    You got the PHP way: it looks pretty much like C or C++, depending on your preferences, and without the strict typing.

    Frameworks are pretty inflexible. Back in the day inflexible programming systems were sometimes called fascist - and for good reason. Why should I spend months mastering the 50,000,000 details of how the Java/Ruby/Python people think I should write an app when I can just write the thing how I want in a non-framework?

  9. Damien Jorgensen

    Simple Solution

    Use ASP.NET

  10. Anonymous Coward
    Anonymous Coward

    Java Doesnt Scale?

    Dont talk tripe! It scales easily, far better than PHP in terms of the overall language and how well supported it is.

    PHP is a cheap low cost server side language used by a couple of largeish sites and nothing of any importance. Wiki is one such example. Its great for general projects as its cheap and people can cheat by using an off the shelf script.

    eBay scales pretty well last time I used it, and thats Java.

    And C++ powering a website? Are you mad or something? Why would you need C++ on any website? Ive never seen an example of a c++ powered website, unless you're taling about using it via a CGI interface.

    Ruby on the Rails, yer great if the framework fits, but then how many people go to the trouble of using a framework, only to write everything and use very little the framework has to offer?

  11. James Anderson

    J2EE + STRUTS + SPRING == Ruby + Rails

    Having programmed extensively in both environments my personal opinion is that PHP is vastly superior to the whole J2EE + STRUTS + SPRING plus whatever mashup you use to get the whole horrible mess to work.

    PHP actually performs better as well. Sure pure JAVA will outperform PHP, but, this is equivalent to prgramming a web site in C++ which nobody except H2G2 actually does. Most real world J2EE apps use layers of abstaction and config file driven classes which turn the whole mess into a very badly written interpreter, which a well written interpreter like PHP can easily outperform.

    Also if you value your own time or you are forking out for programmers by the day you can developop PHP about ten times faster than J2EE and you dont need a team of sysadmins to keep you site running.

  12. Anton Ivanov

    PHP allows you things you simply should not be allowed

    PHP allows you to cut corners in one place too many. As a result you can do things which are very difficult to do in any other "sane" language. Frankly, if something can be done in PHP and cannot be done in R&R, Perl/Mason or any of the Java frameworks you should be asking yourself the question "Am I right in what I am doing or there is a broken design here?". Not asking this is one of the most common mistakes in PHP. The road to "SQL Injection hell" and "cross site scripting" hell is usually paved by good "flexibility" intentions.

    In addition I would say that hiring one of the best R&R developers for a project like this was probably the biggest mistake. This is like using a Eurofighter to shoot pigeons in Trafalgar square.

    If you hire a framework developer and give him an "impossible" problem he will always be tempted to change the framework to fit the requirements. A "commoner" will bounce the request and make you think about the design and make you change it if need be.

    And to conclude, the world not so favourite Canadian is wrong. A mistake in hiring policy, compounded with mistakes in design should not be labelled as a fundamental failure of a tool.

  13. Ralph B

    The Editor of Champions

    "using nothing but vi"

    Nuff sed.

  14. gual

    This article is nonsense

    This is just meaningless nonsense. How can a programming language be better than a programming framework? They are two different things and it does not make sense to compare them like this. Secondly, this has absolutely nothing to do with the James Gosling quote, because as other comments here have pointed out, php is also a scripting language. In summary: a completely nonsensical article.

  15. Anonymous Coward
    Anonymous Coward

    Asbestos underwear on ...

    I'm probably going to be flamed into a zillion pieces here, but PHP and Ruby are two languages which I've never seen the point of - PHP is too much of a bastardised version of Perl for my liking (not surprising since it started out as a Perl module) and I just plain don't like it. It has its adherents, and plenty of 'em, but I'm not one of them.

    Ruby? Looks like the bastard offspring of Perl and Python and, to my eyes at least, provides nothing over and above the two languages it is evidently based on (feel free to correct me, someone). Which brings us to Python and Perl - I love 'em both, but only use Perl for Web applications because stock Python's handling of CGI stuff is a bit clumsy for my liking (I used Python and C for hardcore number crunching in a previous job and it was excellent for that)

    Call me old school if you like, but the combination of Perl ('regular' Perl and mod_perl), C and MySQL work fine for me, even if writing Perl extensions is the programming equivalent of having your teeth pulled out one by one whilst at the same time having 240VAC placed across your tender bits :-)

  16. breakfast Silver badge

    There is a Rails Way...

    The thing about Rails is that it wants your database to look a certain way if you're going to get things done with it. You can play around with it in a whole lot of interesting ways but it works best out of the box if your id fields are all called "id" and foreign keys are called "foreign_table_id" and so on. If you have it to work with from the start of a project it's a fantastic platform, but I wouldn't want to convert an existing application to Rails unless the database was structured in a very railsy way already- I suspect that was the problem in this case.

    As has been noted already, choosing one scripting language over another does not prove that scripting languages aren't powerful enough for the Enterprise. Also most scripting language specialists will suggest dropping into a compiled language for any corners where performance is a real problem and using the scripting language to glue it together. That's always been part of their strength.

  17. Anonymous Coward
    Anonymous Coward

    PHP is also scripting

    How's Gosling's quote relevant? PHP is also scripting. What the story shows is that some people will find the tradeoffs between flexibility and speed that a RAD framework like Rails introduces are not acceptable.

    Rails, not Ruby, was the problem here. I suspect the real issue was with the framework introducing unneeded complexity, and the client introducing unneeded detail.

    PHP cames up on top because it removes the need to fit the framwerok's preconceived model and it can reflect the client's own way of thinking. Ruby without Rails could do the same thing. Scripting, however, wins the day, as it always does

  18. Charlie Clark Silver badge

    Apples and onions

    As everyone else has pointed out: both and PHP and Ruby are scripting languages. Not that that has anything to do with this: Ruby on Rails (and it's look-a-likees such as Django and there must be several PHP implementations) are great for certain kinds of sites but you will get little mileage out of them if you want a different kind of site. This is true for any framework.

    As for performance: memory has become so fast and cheap that the programming language rarely matters. Especially in the Web 2.0 world where bandwidth and throughput are often limiting factors. Swapping Apache for Lighttp or Nginix, adding effective load-balancing and caching seem to be more important.

    Scripting or interpreted languages have become more important as flexibility and speed of development have become more important over raw execution speed. That said: PHP really is awful. Proper programmers use Python! ;-)

  19. Kevin Bailey

    Useful extensions

    And don't forget that by using smarty and pear you have a clean way of templating and extending PHP respectively.

    You can tell these are fairly integrated because they are at

    smarty.php.net

    and

    pear.php.net

  20. Mike Stephens

    Plus ca change

    This could easily have been Cobol to SAP or Oracle Forms to Oracle Financials. Truly gargantuan amounts of money have been wasted migrating 'legacy' systems. In almost all cases you would see the same pattern - refactoring your existing code/logic is going to be a better choice. Use something new if the problem is entirely new otherwise don't.

  21. Phil Lembo

    PHP is a scripting language

    Gosling was, and remains, wrong, blinded by his devotion to slow, complicated and inevitably expensive web frameworks based on Java. As someone pointed out, PHP is indeed a scripting language, designed for the web -- not for controlling toasters. Rails may still work out for many sites, but my impression is that it doesn't represent the improvement for web developers that moving from Perl CGI (my own preferred web scripting language) to PHP did. In fact, after several years of badgering by colleagues, I've finally undertaken to master PHP as an alternative to CGI. That was after looking at Rails and coming to the conclusion that it wasn't a good fit for what I needed to do. And yes, SQL rocks.

  22. Wade Burchette

    My money is still on ColdFusion

    ColdFusion has its faults, one being the cost. ColdFusion isn't ideal for every situation. But ColdFusion is easy to work with. In PHP, it can take me 5 steps to do what I can do in 1 with ColdFusion. For example, database queries require at least 3 steps in PHP, just one in ColdFusion.

    PHP has a lot of functions, more than ColdFusion. That is a good thing. But it lacks some key functions out of the box. One is a easy redirect function. "http_redirect()" requires an extra install, whereas <cflocation> has been around for a long time.

    In short, if it wasn't for the cost, I would use ColdFusion as much as possible, then use PHP for the things ColdFusion can't do well.

  23. Anonymous Coward
    Anonymous Coward

    Umm

    Mr. Eaglestar raised my first point, which is What in the world is PHP if not a scripting language?

    My second is, and you will I hope pardon my ignorance, Who is the world's most popular Canadian? Margaret Trudeau? Margaret Atwood? Wayne Gretzky? Doug or Bob MacKenzie?

  24. Anonymous Coward
    Anonymous Coward

    It is more about a new framework than scripting.

    "scripting languages aren't good enough for enterprises"

    Maybe but this is about Ruby on Rails (a framework) and PHP (a scripting language)

  25. Ed White

    PHP and Ruby are not Web 2.0

    The writer missed the whole point.

    PHP and Ruby (and Python etc) are not scripting languages for Web 2.0. What Gosling said was referred to code running on user's computer. Namely Javascript.

    And I think we all agree that running Javascript in a browser have a lot of limits. And security problems.

  26. Paul

    You have to fit in with the framework

    Using a framework like Rails, instead of just coding everything yourself directly in some sort of programming language, is a trade-off. A framework requires that you do things "it's way", but the payoff is that you can do those things quickly.

    But, if your project just won't fit the way of the framework, or you want to reuse your original database tables in a re-write, there's no substitute for coding the thing the old-school way. Chances are you can't make the framework fit your design, ever.

    If I tried to rewrite any of the sites I work on using another *language*, but keeping the same database tables, I could. In fact most of the heavy lifting is done in SQL, leaving the scripting language to iterate over returned queries and generate the output.

    But the only way they could ever be safely rewritten using a framework would be to throw *everything* away and build from the ground up, redesigning everything with the chosen framework in mind. Anything less would just be begging for pain.

  27. Anonymous Coward
    Anonymous Coward

    the best of every world...

    http://quercus.caucho.com/

  28. E

    @ http://quercus.caucho.com/

    Why would I want to use an interpretter written in Java?

    interpretted ( == kinda slow but wth)

    + java (== just slow)

    --------------------

    = really slow

    Seems to me I can build PHP on Linux, IRIX, , OSF/1, Solaris, Windows, others. I have PHP command line scripts that run on all of these. Where is the need for Java portability?

    And then, say I want PHP with SSL, XML, Curl, PGSQL, MySQL & three other things: a Java implementation will still need openssl, XML libraries, curl, PGSQL libs and MySQL libs, and at least three other things will it not? They're all written in ***___C___***!

    Sometimes I think we should just call Java an elaborate abstraction layer, and have done with it.

  29. A J Stiles

    Redirecting in PHP

    Header redirection in PHP is easy. (Well, it was for me, coming from Perl.) All you need to do is something like

    <?

    header("Location: http://$new_page");

    die(); # just in case redirect failed

    ?>

  30. Anonymous Coward
    Anonymous Coward

    RE:

    Who ever wrote the comment "Java Doesnt Scale?" comment needs to immediately consult a doctor, please ask them for 500mg of "Reality Check" delivered anally!

    If PHP was "nothing of any importance", please explain why there are so many off the shelf scripts for it? its because people love it and developers enjoy writing it!

    Java on the other hand, well afraid thats a sinking ship :D

  31. Robert Synnott

    C++...

    Amazon at least used to be written in C++.

    There are also a few websites running on other fast, natively-compilable languages, like Erlang and Common Lisp. Expect Erlang sites, at least, to become far more common in the near future.

    And speed is by no means irrelevant, even in this age of Web 2.0. Ruby on Rails is quite nice, but slow and awkward to deploy.

    PHP is just a plain horrible language. It is IMPROVING, but it still doesn't have proper Unicode support, for instance; of course, neither does Ruby.

  32. Damian Wheeler

    What the customer asks for isn't what he wants

    We see customers destroying perfectly working software packages with this kind of project mentality. "Give us your package with all these features.... but make it work just like the system we already have". Sounds like he did the same thing. Lets change languages and database platforms (why not the operating system too eh?) but make it do exactly what the existing system does please. As someone else pointed out, having the guru developer on the project just meant he wanted to solve the little problems in detail. He needed to hire (and listen to) a project manager and application designer who would push back earlier and design new applications to make use of the new features and framework. Ruby scales fine with clustered servers too. There are a number of large sites out there using it.

  33. This post has been deleted by its author

  34. Jared

    Scripting languages don't scale

    It's been rightfully pointed out that Gosling's quote had nothing to do with the meat of the article...But I do agree with it. Although I would substitute "scripting languages" with "weakly typed languages." IMHO, It's very difficult to write a scalable app when the principles of object orientation can be thrown out the window either on purpose or by accident. I did Perl in the CGI days, moved to PHP for all the same reasons everybody else did, used ASP.NET for a couple contracts and fell in love, and was more recently forced into Flex + J2EE. For small projects PHP rocks, but when you're writing a large app that has lots of reusable parts, I can't shake the feeling that I'm writing a bunch of "throwaway code." I'll take ASP.NET for scalability any day.

    No matter how smart and flexible a framework or platform is, you're going to have serious problems if you try to make it do something it wasn't intended to do. Whether it's rails, smarty, or sharepoint, you have to evaluate how close of a match your project is to what the framework does. Even if it's a 90% match, that 10% might be painful enough to make it well worth writing something from scratch.

This topic is closed for new posts.