Helpful Information
 
 
Category: Ruby Programming
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?

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

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).

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 (http://blog.ianbicking.org/ruby-python-power.html) 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

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!

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.

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.

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

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 minutesFor my purposes, the Ruby language looks attractive but the Ruby on Rails (http://www.rubyonrails.org) 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.
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 (http://www.cgi-app.org) to Catalyst (http://www.catalystframework.org). 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.
PERL's strength is CPAN. For quick apps that won't be looked at ever again or that need to be put up quicklyIf 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 (http://www.turbogears.org/) on Python is a more flexible solution than RoR but Catalyst lets me do everything I want and use CPAN.

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

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 RoRAre 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 (http://www.template-toolkit.org), Mason (http://www.masonhq.org), etc.). Show me a RoR vs. Catalyst print example that you're thinking of.

i honestly think catalyst is sorta crapy in its class.

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?

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?

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 :)

nm i dont know what im posting.. im just sleeping.. going home now!! :o

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?Are you printing from the controller? I almost never do that. Do you do that ... a lot?

i thought you had to do that in catalyst?

*shrugs*

I have the vast majority of my output handled by a view using TT templates similar to RHTML pages. The only time I print from the controller is when doing very small / simple AJAX responses such as auto_complete. Even if I was using RoR, I'd want to avoid printing from the controller since the output is supposed to be managed by the view in MVC.

I'm not a Perl fan in the least and for the most part it seems like a hack over a hack over a hack so the perly option isn't really for me. I personally find Ruby to be very clear and concise, and more flexible and standardized than Python in a lot of ways, which seems to get uglier all the time.

I don't think it's even worth going into detail comparing Ruby to PHP there's just no competition, Ruby wins :cool:.

It's text manipulation is equal to perls though it's has already been mentioned that perls libs make it far faster to develop anything substantial, not surprising if all the work is done for you and you're just plugging bits together – I'm not comparing RoR etc. I haven't used them ;).

That said they are impressive frameworks; since they're all pretty much in the same class as to what they can do though It really comes down to the language you choose.

Personally: another win for Ruby is that it's feature set is quite compatible with my favorite language [Lisp] so that also makes it all the more attractive in my eyes :).

My $2,

Mark.










privacy (GDPR)