History and Comparisons
Ruby was born in 1995, the same year as PHP, Java, and Javascript were first released.
Table of Contents
Ruby History
The Ruby programming language was created by a Japanese programmer, Yukihiro Matsumoto (known as “Matz” in the Ruby community). Matz started work on the language sometime in February 1993. The first alpha version was released in December 1994.
Matz main goal in developing Ruby was to create a scripting language that was more powerful than Perl, and more object oriented than Python. He blended aspects of his favourite programming languages (Perl, Smalltalk, Eiffel, Ada, and Lisp) to create an expressive new language.
The major guiding philosophy for the language has been “the principle of least surprise”. Matz has often said that he is “trying to make Ruby natural, not simple,” in a way that mirrors life.
Resources
Chunky Bacon
Try reading the following Ruby code out loud:
4.times { puts "Chunky Bacon!" }
When executed by a Ruby interpreter the output is:
Chunky Bacon!
Chunky Bacon!
Chunky Bacon!
Chunky Bacon!
Chunky Bacon in Java
Here is the same program written in Java.
class ChunkyBacon {
public static void main(String[] args) {
for (int i = 0; i < 4; i++) {
System.out.println("Chunky Bacon!");
}
}
}
When compared to Ruby, the Java version has some extra baggage:
- A ChunkBacon class required to wrap the entire program.
- A
public static void main(String[] args)
method required to wrap the mainline. - A verbose for loop instead of a concise iterator.
System.out.prinln
vs.puts
- Semicolon required as an instruction separator.