tags:

views:

262

answers:

9

I decided to learn Ruby, and I wanted to ask what sort of things you felt Ruby did better than other languages, facilities it has, and the position of the language in the industry today, amongst other languages, is it a strong competitor? What target audience is it aimed at, web-developers/GUI-programmers/10 line scripters? Kindly give me your opinion :)

+1  A: 

Ruby is way better at anything related to text processing, and is very good at being flexible, that is, to give developers the power to write very elegant, readable code. If you want speed, this isn't the place, but for a lot of things it doesn't matter.

If I had to give one thing Ruby excels at, it is that it is fundamentally designed to be very readable - Matz writes about this in Beautiful Code, that well-written code is an essay to communicate ideas to other people, not to computers.

Paul Betts
A: 

The things I love most in ruby, in contrast to python, are blocks and the retry command. It is really useful and can lead to incredibly more legible code.

Georg
A: 

One biggest reason to learn Ruby is to make full use of its fantastic RoR framework for building web apps. Besides this Ruby can do almost everything other popular languages can do. Ruby is better documented, has large community and in case of RoR in particular uses best practices. Ruby has awesome readability. It has some nice concepts like mixins, blocks etc that makes it an excellent OO language.

Perpetualcoder
+2  A: 

Ruby is a good language in which to design and use "internal Domain-Specific Languages", DSLs for short. A DSL is a notation specifically designed to represent some particular business domain; "internal" to distinguish between notations which are incompatible with the host programming language (an example would be XML notations for project build files) and notations which are a variant of the host language (for instance, the Ruby equivalent of Make, called Rake). See e.g. Martin Fowler's article.

Morendil
+3  A: 

Personally, I have 2 use cases for Ruby:

Maintenance scripts. I have a lot of tasks at work that I'd classify as "maintenance". These tasks range from manipulating data from an excel spreadsheet and importing into a SQL Server Database to cleaning up a directory full of files to generating test data that I don't want to manually create. Some of these scripts are quick 10 line scripts and some of them expand out into small applications that I use quite frequently.

There are a few things that make Ruby really nice for this:

  1. It's really easy to get started with a script. Tools like Rake are designed for organizing tasks, and I don't need to create a bunch of extra framework junk just to get started.

  2. Libraries. I know that other languages supposedly have superior libraries, but so far Ruby's libraries have suited my needs. And RubyGems makes it really easy to install a library without having to manually download and install it.

  3. Ruby has a lot of built features that make reading and processing files really simple.

  4. DSLs. There are a lot of tasks that are repetitive and lend themselves to creating domain specific languages. Ruby has a very flexible syntax and it has some functional aspects that give you a lot of flexibility in the way that you write your programs. Often, you can wrap up common functionality into a DSL that's suited for your task.

The other thing I use Ruby for (to a lesser extent) is web development. The Ruby on Rails framework is what I've used mostly, but I played around with Merb a little bit before the announcement that it was merging with Ruby on Rails.

I like Ruby on Rails for all of the reasons that I like Ruby. In fact, it's mostly the features of Ruby that make Ruby on Rails great. Rails itself is a domain specific language written in Ruby that make web development a lot more fun (in my opinion) and speed things up quite a bit.

I think a lot of people feel the same way I do about Ruby, and the community still seems very active and vibrant. I think it's a great language to learn that's going to be used for quite some time.

Matt Ephraim
On the "maintenance scripts" point, there's a pretty good book called "Enterprise Integration with Ruby", a whole book on how to glue stuff together with Ruby. I don't know any other language that has a whole book dedicated to writing glue code in it.
womble
Oh, interesting. I hadn't heard of that book. Another book that taught me about using Ruby for all kinds of things is the Ruby Way.
Matt Ephraim
A: 

ruby is great for prototypes. its amazing how fast you can write a profe of concept in ruby. the language gives you anything you need and stays out of your way

LDomagala
A: 

@gs: Ruby has recently debunked the retry facility.


Lambda expressions in Ruby utilize very lightweight syntax, making them pseudo-invisible.

Obscure things like anonymous blocks are provided, (I'm currently unaware of many other languages that have this provision).

Syntax consistency exists, even with mannerisms that can be used in place of others, it has a near English sentiment, creating an environment where even the most ignorant of novices would feel comfortable in. Code is much shorter, and compact than the conventional C/Java and Python mantras.

Everything is an object.

It allows for internal Domain-Specific Language manipulation and control.

There are probably dozens more I could list, and possible even more cons; I tend to write small quick and dirty programs I need on a daily basis; I haven't been coding in it very long, but its definitely something a beginner should look into. I know I enjoy working with it :)

You should probably look into this if you want to learn Ruby. You should also read this too

Achluon
@Achluon: Can't be! Any idea why?
Georg
+1  A: 

I code just about everything except Excel macros and heavy-duty/long-running mathematical functions with Ruby. And I usually prototype the latter in Ruby first. I haven't written any non-web UI stuff for a while and would think twice about using Ruby for that, although to be honest I'd think twice about doing it at all. shoes and wxRuby are interesting. If I was going to write a game, I think my limited ambitions would be catered for by gosu

Right now, "everything" mostly consists of:

  • Rails and related stuff
  • Task automation and scripting
  • Project Euler puzzle coding

"What does it do better?" is a bit subjective. I prefer it to Python and Perl, at least in part because of its fundamentally object-oriented design. I like its terseness, close to Perl but more readable. I like the openness of the built-in classes, letting me add methods rather than having to create new classes. I'm fascinated by the variety of alternative implementations that are appearing and the potential to apply a comfortable syntax to new problem domains.

It isn't lightning-fast (although it's getting faster) but to be honest, mostly it's fast enough: I don't have a significantly different experience between programs that take 10 milliseconds and 10 microseconds.

Mike Woodhouse
A: 

In every case where I'd use a Perl script before: system administration scripts, text-processing, access to databases such as Oracle, LDAP. Probably 95% of my current programming is done in Ruby. Web applications wit frameworks such as Ruby on Rails & Merb.

Keltia