Humble Little Ruby Book

By Jeremy McAnally
Available in print ($10)

What is Ruby anyhow?

Ruby is an open-source, multi-paradigm, interpreted programming language (a bit of a mouthful I know! I'm going to explain it, I promise!). Ruby was created by Yukihiro "Matz" Matsumoto, a very fine Japanese gentleman who currently resides in Shimane Prefecture, Japan; Matz's work on the language was started on February 24, 1993 (commonly considered the birthday of the language; I hear that over in Japan they roll out a two-story cake and sing) and released to the public in 1995. Ruby is often hailed as one the most expressive and concise languages available to developers today. In that spirit of expressiveness, let's look at exactly what it all means. Let us now eviscerate these verbal furbelows with conviction!

Open Source

The official implementation of the language is free software distributed under the GPL and the Ruby open source license. If you're unaware of what "open source" means, then look at it this way: Matz programmed the entire Ruby interpreter and library, then gave away the code he used to do it. Since the source code is available, people can now take it and improve it. Many people take the code, improve it, and Matz (and his crack team of maintainers) integrate their changes back into the main source code. The benefit of open source is chiefly that you get a lot more minds working on a project than a proprietary project (and typically for free to boot!).

Multi-Paradigm

Like to write code in a functional style a la Haskell or Scheme? That's cool; Ruby does that. Really dig object orientation like Java or Smalltalk? No problem; Ruby handles that, too. Prefer to use a procedural (a.k.a. imperative) style like Forth or Ada? Ruby can "get its procedure on" as good as any other language! Don't know what any of those mean but just really want to program? Excellent! Ruby is a multi-paradigm language because it doesn't constrain to a single programming mindset; you can use any of the aforementioned programming paradigms with no problems in Ruby. You can pick the one you prefer (or the easiest for you to learn) and go with it: Ruby doesn't mind. Unlike some other languages, it doesn't get jealous and give you "errors" if you break it off with objects and decide to go steady with closures instead.

Interpreted

If you've used something like Assembly, Pascal, Fortran, or C/C++, you've used a compiled language. "Compiled" means that you've had to run your code through a little compiler and it spits out some sort of native code that will run without any sort of interpretation by the computer other than by the operating system itself. This can become time consuming as your project grows larger and larger, and sometimes can even be a severe hindrance to productivity. Oh, but there is another way! Ruby is an interpreted language, which means that there is an interpreter that reads your code and then emits native code to the operating system. The interpreted nature of Ruby allows it to have many of the features that make it so great. Compiled programs are not nearly as dynamic as interpreted ones because they don't (usually) allow for runtime change to code or the application itself. Because interpreted programs are simply, well, interpreted from their original source (or a slightly compiled bytecode), they can allow for more far-reaching runtime interaction.

...

Download PDF.