views:

396

answers:

13

Hello!

So I took a quick look at Ruby some days ago. At first I was quite astonished by some things it features which really seem to make a programmers life easier. (Use of blocks, object model,...)

But then there is this big problem: Nobody seems to be using Ruby without Rails! The #Ruby(-lang) channel is dead, people are only talking in #rails

I'm going to stick with PHP for web development, no question, but

  • Does actually somebody use Ruby as a general-purpose language and not for web development?
  • Has Ruby (good) libraries for "offline" apps?
  • This may be subjective, but should I just stick with Python for non-web scripting?

I don't want to learn Ruby to find out that it's general-purpose part is actually dead!

best regards, lamas

+8  A: 

I prefer to write general scripts in Ruby because I find the language more intuitive than Python, Perl, or bash. For example, using Ruby to rename files and edit their content, also chmodding and Ruby.

See also Ruby Top Projects. It includes some Rails-related apps but other Ruby projects that do not involve Rails as well.

Sarah Vessels
What about "bigger" things? I suppose that you use it for small tasks only, or?
lamas
It depends on the task. If I were going to write a desktop application, I'd probably choose Java or .NET. I've done web apps with Ruby before without using Rails, and I would probably use Ruby for a more involved console application, too.
Sarah Vessels
+1  A: 

As far as the dynamic scripting languages go, Python has a firm hold on the non-web-application market. I've seen some small projects written in Ruby, but nothing production-level. Python on the other hand has several powerful systems under it's belt.

My suggestion? Stick with Python for non-web stuff, and give Python a shot with web stuff. Ruby is great with Rails, and is definitely worth looking into for web development.

Mike Trpcic
Thanks for your answer but regarding web dev, I'm perfectly fine with PHP. I have used it for years and got some experience in it now too
lamas
+2  A: 

Ruby is awesome for all kinds of things. But Rails is the killer app. If you want to write small scripts that do minor stuff, it probably doesn't matter much. If you want to write large non-webapp programs in a scripting langauge, it may be worth learning Ruby. But if you know Python and love it, no huge reason to jump ship either.

Learn Ruby because it's a fun language and knowing it will make you a better all around programmer. But it doesn't sound like you need ruby.

Squeegy
+1  A: 

I used to do a lot of Ruby scripting/programming because of what Ruby offered compared to Perl. I chose Ruby over Python partly because of the hype and was generally happy with it.

When I will need a dynamic object oriented scripting language again, I will probably choose Python as it feels easier to comprehend to me.

Anyway, it is an individual choice and let us see what the other answers reveal...

Christian Madsen
+2  A: 

At my work, the core is about 93,000 lines of Ruby, not including the DSLs, tests, and Rails.

Wayne Conrad
+11  A: 

I prefer Ruby to Python for general scripting and calculations. I find Ruby a bit smoother to use, though Python does have it's market in the non-web applications. Ruby has quite a few good selling points without Rails(note I don't use Rails, I think it's messy in a weird way). Such as the GTK bindings for Ruby are truly amazing. Making a hello world graphical application in like 5 lines is just amazing...

The other bad thing about Ruby is that at the moment, it is slower than Python. So your choice to learn Ruby should really just depend on your needs. Are you programming for fun/as a hobby or are you trying to produce commercial applications? Python is also more generally accepted for commercial(at least more than Ruby)..

Earlz
+1 I love ruby as a general purpose/hobby language and I am a systems programmer. No web sites for me, still a very useful language.,
Ed Swangren
yea, I am as well. I have a website though.. I just wish there was some simple way to use a light amount of Ruby in my website like I can PHP...
Earlz
If you're after something light, take a look at Sinatra.
Tate Johnson
@earlz - if you want a 4-line "hello world" web-site, second the [Sinatra](http://www.sinatrarb.com/) recommendation
Mike Woodhouse
Well, I've been meaning to look into it... It just doesn't have the same scripting flow of PHP, which most people would say is the best part, but I'm a bit weird... I like easy solutions even if they aren't the most elegant... I really will look into that though cause I've heard a lot of good things about it.
Earlz
+9  A: 

Does actually somebody use Ruby as a general-purpose language and not for web development?

Yes. As a bonus, it's my day job.

Has Ruby (good) libraries for "offline" apps?

Yes.

This may be subjective, but should I just stick with Python for non-web scripting?

You'll not regret learning it for either web or non-web scripting. That being said, python has its strong points as well. They are both very capable languages. IMHO ruby is the more elegant weapon.

  • ruby has no whitespace requirements
  • ruby has better syntax
  • ruby is more expressive
  • python might be quicker
  • python arguably has better libraries for certain things

And remember, rails is not the only platform for web programming in ruby.

+2  A: 

In The Python Paradox, Paul Graham argues that the best programmers often enjoy "comparatively esoteric" languages. They don't enjoy them because they'll help land you a job. They enjoy them because "comparatively esoteric" languages can be interesting and beautiful. His essay is over 5 years old so a lot has changed - I don't think Python or Ruby can be considered esoteric. Still, the idea is the same. Is there any better reason to use a language other than you think it's interesting and maybe even a little beautiful?

Corbin March
+2  A: 

A lot of people see Ruby and Rails as synonymous. I do not do any web development, but I use Ruby nearly every day. I find it to be an excellent general-purpose language. I don't want to get sidetracked evangelizing the language, but it's a language I enjoy using and have found many uses for. There are a wide variety of libraries available for Ruby that don't have anything to do with web programming. There are also commercial applications out in the wild that use Ruby (Google's SketchUp, for one).

If you are interested in learning the language for general use, I recommend reading through the book "Programming Ruby" (which can be found on-line for free at ruby-doc.org).

If the #Ruby channel is dead, try subscribing to the Ruby user's mailing list. There is a large subscriber base and a lot of discussion going on.

bta
+1  A: 

I use Ruby a lot and do not do web development and find that Ruby is a great language for writing general applications.

You will find for any given application Ruby provides many well-designed and regularly maintained libraries; and as an added bonus, almost all Ruby developers host their code on github so contributing to these libraries is a piece of cake. Add to this the simplicity of installing and updating libraries using Ruby 'gems' and you have an almost complete package. The one potential downside to Ruby is a slight lack of documentation for some libraries, but this situation is improving rapidly.

In general Ruby is a wonderful language that is very well-designed and beautifully expressive. One of the things I enjoy is watching the 'Ruby Reddit' pages and seeing the creative ways the community keep extending the language. I can definitely see it used far beyond web-development, it just so happens that its current "killer-app" is Rails.

You do not need to be concerned about choosing Ruby, it has a very bright future.

banister
+1  A: 

Give Ruby a try. It's a fun language. Plus I don't see anything wrong with learning something new. It's not like you're going to die of too much knowledge

pgmura
+2  A: 

Absolutely Ruby is worth learning, is intuitive and elegant and extremely concise. I've used Ruby for years to automate build processes, compiles, install builds, even used WebBrick for a lightweight CI server (before TeamCity made my life much easier). I am on a Rails project now, but loved Ruby long before I ever did a web project with it.

There are plenty of libraries to do everyday scripting tasks. File IO is dead simple. Cron+Rake is a great way to manage recurring tasks.

In short -- do it.

Dave Sims
+2  A: 

The distance between thought and implementation with Ruby is joyfully short, second perhaps only to Lisp/Scheme... this has nothing to do with Rails.

Pick-up Matz's new book from O'Reilly and get fluent with Ruby 1.9, you won't regret it.

With respect to Ruby being dead, I'd say the current drive for a language spec and ISO standing belies that.

Mike