Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kainjow

Moderator emeritus
Original poster
Jun 15, 2000
7,958
7
Anyone here use Ruby much? What, besides Ruby on Rails, are its advantages over Python, PHP, Perl, etc? I'm eager to learn Ruby on Rails for some fast web apps development, but beyond that I don't see much of an advantage for normal scripting. I tried to convert a very small script (only a few lines) that simply parses out some text via regex from the stdin, but the Ruby verion was slower (using a simple 1 liner and code blocks).

Thoughts?
 

kainjow

Moderator emeritus
Original poster
Jun 15, 2000
7,958
7
Sheesh, so none of you have any insight on Ruby? You'll all stuck using Java? :p
 

DXoverDY

macrumors 6502a
Apr 19, 2005
810
0
kainjow said:
Sheesh, so none of you have any insight on Ruby? You'll all stuck using Java? :p

ruby just provides structure that is absent from php and perl. everything is an object, unlike java, and it points you to using objects to your advantage.

in MOST web applications speed isn't so much of an issue.. especially when you can easily scale the hardware up. so where rails gives you the biggest gain is in development time. it lets you write your application rather than deal with the nitty gritty boring details that take up your time, plus it's tested, and btw, ruby has wonderful unit testing facilities and functional testing facilities right outta the box.

so it's not necessarily the speed of rails or ruby that is the selling point, it's the speed of development and ease of development and maintenance
 

WebMongol

macrumors member
Sep 19, 2004
50
0
Bay Area, CA
kainjow said:
Anyone here use Ruby much? What, besides Ruby on Rails, are its advantages over Python, PHP, Perl, etc? I'm eager to learn Ruby on Rails for some fast web apps development, but beyond that I don't see much of an advantage for normal scripting. I tried to convert a very small script (only a few lines) that simply parses out some text via regex from the stdin, but the Ruby verion was slower (using a simple 1 liner and code blocks).

Thoughts?
Check out this site for performance comparison of 3-4 dozens of programming languages/compilers:
http://shootout.alioth.debian.org/ruby.php
Current implementation of Ruby and Ruby run-time is 2-3 time slower than Perl and Python. For scripting I mostly use Python. I checked Ruby a few months ago and did not find really strong advantages over Python.
But if you currently use Perl and performance is not very important - Ruby looks as a good candidate for next language.

If you really want to try Ruby on Rails - you do not have much choice but bite the bullet and dive into Ruby.
 

kainjow

Moderator emeritus
Original poster
Jun 15, 2000
7,958
7
Ah, thanks for the info. So it seems Ruby is strong mainly as a fast web development language with Ruby on Rails. But for normaly scripting, it's weak on performance. Gotcha :)

I've actually already upgraded my web server to a new one that supports RR, so that I can start learning it. Looks to be exciting.
 

DXoverDY

macrumors 6502a
Apr 19, 2005
810
0
kainjow said:
Ah, thanks for the info. So it seems Ruby is strong mainly as a fast web development language with Ruby on Rails. But for normaly scripting, it's weak on performance. Gotcha :)

I've actually already upgraded my web server to a new one that supports RR, so that I can start learning it. Looks to be exciting.

if you just want to start learning it, Rails comes with it's own webserver webrick. you just type ./script/server and it fires up ...

also, you think of it as slow, it's not really slow. there's lots of power under the hood, and if you're using fastcgi very little code gets executed along the way. it's interpreted once, and then stored in memory. it can serve thousands of hits per second without flinching if you use Lighttpd and FastCGI/SCGI. no web framework NEEDS to be as fast as perl or php in this. also, for normal scripting, i've found that it's also easier to write apps faster. i just all around love ruby. python makes me sick, so does perl, and php is a giant mess of a language that doesn't get anything right.

if you're familiar with python, try out Django or TurboGears. TurboGears is hosted at TextDrive, my host of choice for web related stuff.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.