views:

432

answers:

7

What applications can you make with the programming language Ruby? Can you name a few commercial/famous ones written only in Ruby?

What I'd really like to know is can you just learn Ruby instead of C/C++ to make commercial software e.g web server, photoshop, desktop applications, even an operating system etc.

Except Ruby on Rails which I already use!

A: 

Ruby on Rails ? Some applications listed here.

People use most any programming languages to found a business upon. You won't just see them in the customer-facing application, but also running the back-end. I suspect most every technology referenced on this site is used successfully in a business. I know whenever I visit a new client I will find something new and unexpected that I've not seen before.

Brian Agnew
A: 

Ruby is a scripting language (rather than a native language, like C and C++ are); this means that it is not ran on the processor but rather interpreted by another program, which means it will run a little slower.

For that reason it's not suitable to make high performance applications like a web server, and it would be impossible to create an operating system with it (because like I said you need an interpreter, and it can't run "above" the OS).

Andreas Bonini
Ruby could be compiled, for instance IronRuby does this (I think). Whether a language is interpreted or not isn't really a property of the language, it's a property of the implementation. Just look at the way Java moved from mostly-interpreted to mostly-JIT-compiled. Obviously by heavy use of "eval" in Ruby, a particular program could pretty much ensure that compiling it has no benefit...
Steve Jessop
Ruby can't be compiled to byte code though, as far as I know (I even tried googling to be sure about this and it looks like it isn't possible). So making an os 100% in ruby it's out of the question, since you can't make the JIT in ruby too.
Andreas Bonini
Maybe. I don't see why you couldn't write a "ruby2asm" compiler, which takes Ruby as input, and spits out equivalent x86 assembler. I also don't see why you couldn't write such a compiler in Ruby, and bootstrap it using an interpreted Ruby implementation. Then the world's your oyster. I suspect it would still have performance problems to do with the way Ruby does dynamic dispatch for everything. But that's not because it's interpreted, it's because it's dynamic.
Steve Jessop
Apple's MacRuby implementation can compile to native code.
Chuck
+6  A: 

Ruby is mostly known for web applications built on Ruby on Rails, such as those written by 37signals or the front-end of the Twitter website. However, with IronRuby running on top of Microsoft's CLR you can write any kind of .NET application using Ruby. There's also an implementation of Ruby, JRuby, that runs on the Java virtual machine, and which could be used to write web or desktop applications on that platform. Oh, and MacRuby will let you write Cocoa applications for Mac OS X.

Rich
+1  A: 

Few apps listed here: http://rubyonrails.org/applications

jspcal
Please don't confuse Ruby with Ruby on Rails.
Simone Carletti
@weppos: It's not confusion — Rails is Ruby. Any Rails app is a Ruby app.
Chuck
+1  A: 

Some years ago I worked for a small consulting/contracting firm that was acquired by a larger national firm of the same type. At the time the larger company had a system similar to VB that it actively marketed to clients by a very large marketing staff at the local branch office, and one of my coworkers was all hot to learn it. "Geez, if we just learn that we'll never have to learn anything else!" was his oft-quoted observation. As time went on it became apparent that clients had no interest in this particular development tool, and eventually the marketing staff was let go and the product languished.

My point is, no matter how hot one tool is today you're going to have to learn something new tomorrow. That's just life as a software developer. I've been doing this for some time now and I haven't used one single language that I learned during my formal course of education in nearly 20 years, and yet because I'm willing to take on new languages (the differences are mostly just syntax anyways - the concepts are the same, with perhaps a couple of twists) I've been able to keep on doing what I like.

As far as "why learn C" goes, the interfaces to most operating systems are based on C, so if you want to call an OS service you'll need to understand a bit about C. In any case it's a good thing to learn, because to get good at it you'll have to learn how to use pointers properly, you'll have to understand how and in what order arguments are pushed onto the stack (this helps you understand why writing procedures with a variable number of arguments is easy in C but hard (impossible?) in Pascal), and a pile of other details that will serve you well no matter what other language you use.

I hope this is helpful.

Bob Jarvis
+3  A: 
  • No: OS kernel or device driver
    Perhaps someday a Ruby-subset compiler will appear, but since we already have C/C++ and since they are perfectly suited for this sort of thing, why bother with something else?

  • Maybe: Low-level library or communication daemon
    Writing this kind of thing in a "higher order" language tends to restrict its use to clients of the same language and framework, whereas a C/C++ library can be more universally useful.

  • Maybe: Local desktop GUI application
    In theory Ruby would be great for a local GUI app, but since most Ruby applications are recently developed, they seem to me to be concentrated in today's problem areas: web applications and server administration. I'm not sure what the state of the local-Ruby-GUI combination is.

  • Everything else: I think the rest of the higher-level and tools applications are potentially good places for Ruby. It's typical to warn against doing something computationally intensive in any interpreted framework, but I think this depends. For example, a scientific package built using matrix arithmetic might do well in Ruby as long as a C extension implemented the actual matrix math. So m.multiply and m.invert might be C, but everything else could be Ruby and would anyone ever notice a speed difference?

DigitalRoss
+6  A: 

What applications can you make with the programming language Ruby?

Ruby is Turing-complete, which means that everything that can be written in any other Turing-complete language, can also be written in Ruby. Also, no language can be more than Turing-complete, which means that anything that can't be written in Ruby, can also not be written in any other language.

Can you name a few commercial/famous ones written only in Ruby?

One very famous application that is a) famous completely independent from Ruby, and b) famous long before Rails came along, is FreeBSD's portupgrade command.

Metasploit is a network security toolkit written in Ruby.

LimeChat is an IRC client written in Ruby.

The US Government's National Geophysical Datacenter uses Ruby to run their image processing cluster, processing terabytes of satellite data every day.

NASA uses Ruby for statistics, simulation and also unit testing Fortran programs.

The Monterey Bay Aquarium Research Institute (MBARI) has an autonomous underwater laboratory, called the Environmental Sample Processor (ESP) which can collect water, particle and microorganism samples from the ocean and run several molecular experiments and genome analysis right there, under water, all by itself. It runs Ruby. Now, it's not commercial, and probably doesn't count as famous, either, but hey, it's a friggin' underwater robot!

Note: there are many more. I tried to find the least obvious ones I could think of, since I figured someone else would post Twitter and Basecamp anyway.

What I'd really like to know is can you just learn Ruby instead of C/C++ to make commercial software e.g web server, photoshop, desktop applications, even an operating system etc.

Well, there are multiple web servers written in Ruby; one of them (WEBRick) ships in the Ruby standard library. There are also multiple desktop applications written in Ruby (some listed above).

Adobe Lightroom is written largely in Lua, with only the hardcore image processing done in some lower-level language (I think C, but I suspect there might be a whole lot of MMX/SSE assembly in there, too) but the UI, the batch processing, and application logic are all implemented in Lua. Also, Lightroom is developed in an IDE Adobe specifically wrote for this task, which is written 100% in Lua. There is no reason why the same couldn't be done in Ruby. There is also no reason why there would have to be C or assembly in there, it's just that modern mainstream CPUs are heavily tuned for C and pretty hostile for languages like Ruby or Lua. Also, Adobe is a pretty old company, so they have tons of image manipulation code written in C or assembly just lying around, so why rewrite it?

As for operating systems: like with Photoshop, I don't know that anybody has done it yet, but there is no reason why they shouldn't be able to. Ruby is closely related to Lisp and Smalltalk, and both of these have multiple operating systems written in them.

Now, whether you can actually get a job writing an OS in Ruby, that's a whole other question :-)

However, there is pretty much no execution environment for which no Ruby execution engine is available. For the JVM, there is JRuby, which also runs on Java ME smartphones, Android and Google App Engine. For the CLI, there is (soon) IronRuby, which runs on all the important CLI variants: .NET, Mono and Silverlight. For the Objective-C runtime, there is MacRuby, which is officially sponsored by Apple and is indeed targeted to become a standard way to develop OSX desktop applications. (It's also probably going to run on the iPhone, although the MacRuby developers, being Apple employees, are not allowed to officially acknowledge that fact.) For Unix-like systems, there are MRI, YARV and (soon) Rubinius, which also run on Windows and many other systems, although maybe not quite as fast and stable.

Jörg W Mittag
So are you saying that i dont need to learn Objective C to develop for Mac OSX/iphone and can just use MacRuby? Thanks for a great answer above!
Imran
There is nothing official yet. Also, MacRuby hasn't even been released yet. But latest versions of MacRuby can statically compile Ruby code to native code without the need for an interpreter. And when asked about, one of the MacRuby developers said that "this might in the future enable Ruby to run on a certain phone-enabled mobile internet device". But not yet. First, MacRuby has to even be released in the first place. Second, several technical hurdles have to be overcome, not the least of which is the fact that the Objective-C runtime on the iPhone doesn't have a garbage collector.
Jörg W Mittag
I can't believe I forgot the MBARI ESP underwater robot laboratory, which runs Ruby. Duly fixed.
Jörg W Mittag