Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    418
    Rep Power
    13

    Ruby vs Other scripting languages


    Hi,

    I'm just wondering what the advantages of programming web apps in Ruby are compared say PHP, Python and Perl?

    I did a google search and I can't really find a decent answer.

    All O know right now is that Ruby is easy to develop in. Before that it was all about PHP being easier to develop in than Perl, which is why I prefer PHP to perl.
    Is Ruby good for text parsing? Computations?
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    The advantage is not really because of the ruby language itself, but mainly because of the Ruby on Rails framework engine. There are framework engines in other languages (Perl's Mason is what we use (there are others as well) and Python has more than one engine, there's even a couple for PHP) as well, but the Rails framework is particularly impressive in terms of what you can do with it and how quickly you can do it.
    http://www.rubyonrails.org/

    Efficiency of the framework is assumed to be of secondary importance, of course. On the plus side, look at the speed you can develop things with the Rails framework:
    * A Blogger Application in 15 minutes
    * A Flickr style album in 5 minutes
    http://www.rubyonrails.org/screencasts
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    214
    Rep Power
    58
    I do think there is an advantage to the language of Ruby itself (at least over PHP). I am currently only able to develop in PHP and a bit of Perl, but am learning Ruby. It is a much more 'natural' language, has the ability to be organized a bit easier, and makes everything an object.

    I am not a programmer by trade, but have learned programming out of necessity. I am really excited to get into Ruby more (even outside of Rails).
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    London, England
    Posts
    1,585
    Rep Power
    1373
    I cannot speak for Perl and PHP, but IMHO Ruby and Python are pretty evenly matched. Some things are done better in Ruby, some are better in Python. There is a good article by Ian Bickering that lays out a point-by-point comparison between the two languages.

    Personally I am sticking with Python until I have a good reason to change, for the following reasons:

    1) Python is significantly faster, and has several options for further speedups if required (e.g. Pyrex, Psyco).

    2) Python has much better support in terms of libraries, tools, documentation, books etc - it is simply much more mature. Ruby is catching up fast though.

    3) Python lets you define default parameters for methods and to name parameters in the calling code. This simplifies a lot of things, and can make the code much more readable.

    4) functions and methods are real objects in Python - you can pass them around and get their attributes.

    5) I get paid for programming in Python.

    Don't get me wrong, I like Ruby a lot. But I like Python more.

    Dave
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    162
    Rep Power
    11
    I've been a full time perl programmer for 5 years. I've helped to develop large stand alone applications and large web applications, all of which were very database intensive. Over the last several years I've had to do alot of maintanece on these apps. This is where perl begins to fall short of Ruby. Perl doesn't force good practices when writing code and if you don't force yourself to do it, you're in for alot of trouble when it comes time to add new features or perform routine maintenece. The Ruby language doesn't force you to write good code either but it definately steers you in the right direction. In Ruby, everything is an object. This helps you to put like code into classes, which in turn makes upkeep much easier. I've only been using Ruby for about 6 months and I was able to take a 20,000 line web app written in perl (and the template-toolkit) to only 8,000 in ruby on rails. The Ruby language in concise and to the point. The biggest problem I have with Ruby is the lack of books on the subject. Rails is solving that problem as we speak. I am now a Ruby enthusiest and will program in it whenever I have the choice, but I will always love perl!
  10. #6
  11. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1051
    PERL's strength is CPAN. For quick apps that won't be looked at ever again or that need to be put up quickly, CPAN will have some modules you want (like NET::IRC, would take ages to write that in ruby).

    Ruby is a good language for everything though, and rails give it a lot of nice background classes to help simplify programming.
  12. #7
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2005
    Location
    Antalya
    Posts
    80
    Rep Power
    9
    I myself am wondering if RUBY will be having any advantage/ease of use over php. However in the meantime i am also afraid that it will be more a 'higher level' platform and wont offer the flexibility of delving directly into the code ?

    Ill be very happy if someone who had experience with ruby detail here what it is, and what it is not.
  14. #8
  15. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1051
    it's general purpose, can do whatever php can do really...

    it's also more object oriented.

    strings are objects, eh.

    "blah".upcase

    it has hashes, lists and scalars like perl, except they're all objects.

    x = {'james'=>'linuxpenguin'}

    it also has inline regexps.

    And it has rubyOnRails... a Great development framework
  16. #9
  17. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Posts
    1,137
    Rep Power
    173
    Originally Posted by Scorpions4ever
    The advantage is not really because of the ruby language itself, but mainly because of the Ruby on Rails framework engine.
    [...]
    * A Blogger Application in 15 minutes
    * A Flickr style album in 5 minutes
    For my purposes, the Ruby language looks attractive but the Ruby on Rails framework is too limiting. My current app wouldn't be doable on RoR or it would be very difficult. The Flickr in 5 minutes is misleading and a downer since it's not a Flickr-style album, it's a search interface to Flickr using a pre-built query library. I wasn't very impressed but I've heard it impresses a lot of Java programmers that haven't been exposed to scripting languages. However, I will admit the Blogger in 15 min is pretty nice.
    Originally Posted by beachguy82
    I've only been using Ruby for about 6 months and I was able to take a 20,000 line web app written in perl (and the template-toolkit) to only 8,000 in ruby on rails.
    The comparison here is Perl with a templating system to Ruby with a framework. People have gotten similar and better results converting from one Perl framework to another: CGI::Application to Catalyst. Anything in Ruby on Rails that's going to be compared to Perl should be compared to apps running on Catalyst. The primary difference between Catalyst and Ruby on Rails is that Catalyst has a default way of doing things but gives you a lot of flexibility to change things while RoR primarily has one way of doing things. That provides different strengths and weaknesses.
    Originally Posted by LinuxPenguin
    PERL's strength is CPAN. For quick apps that won't be looked at ever again or that need to be put up quickly
    If you want to use CPAN and build web apps, Catalyst is a great framework that improves your Perl code. And if you do it right, looking at your code a few months down the line won't give you headaches! Catalyst's example apps provide good tips on streamlining Perl code. Ruby is a great language because it's elegant. Ruby on Rails is great if you don't need CPAN and can live with its constraints. I'd like to use RoR for a project but I tend to love building highly customized features and if you have a large DB, manual adjustment is a requirement.... not sure if RoR is good for that. TurboGears on Python is a more flexible solution than RoR but Catalyst lets me do everything I want and use CPAN.
    Last edited by Conundrum; January 26th, 2006 at 04:01 PM.
  18. #10
  19. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1051
    The problem i have with catalyst is the verbosity problem, it's $blah->blah.blah() just to print something which i think is ridiculous. Nethertheless i'm downloading one of the videos to compare it to turbogears and RoR
  20. #11
  21. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Posts
    1,137
    Rep Power
    173
    Originally Posted by LinuxPenguin
    The problem i have with catalyst is the verbosity problem, it's $blah->blah.blah() just to print something which i think is ridiculous. Nethertheless i'm downloading one of the videos to compare it to turbogears and RoR
    Are you comparing setting output in the Controller with Catalyst vs. output in the View (RHTML page) with RoR? If you are, you can do something similar to RHTML in the Catalyst View (TT, Mason, etc.). Show me a RoR vs. Catalyst print example that you're thinking of.
    Last edited by Conundrum; January 26th, 2006 at 01:56 PM.
  22. #12
  23. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    i honestly think catalyst is sorta crapy in its class.
  24. #13
  25. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Posts
    1,137
    Rep Power
    173
    Originally Posted by xlordt
    i honestly think catalyst is sorta crapy in its class.
    Which ones are you comparing, how would you rate them and based on what criteria?
  26. #14
  27. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1051
    no, the text to be output it's

    $class->output->write("blah") or something similar for catalyst (i can't remember the exact names)

    in ror:

    puts "blah"

    just the simple ruby print. Why is there a need to be convoluted in catalyst?
  28. #15
  29. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    Originally Posted by Conundrum
    How would you rate them and based on what criteria?
    i rather stick to perl.. its almot alike... also.. check out LinuxPenguin then your question will be answered
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo