Picking a Ruby along the road
Ruby is the name of a gem, but also a programming language. Since the early days of the free open source software movement in Italy in the 1990’s, I have memories of friends – especially the geekest – who felt in love with this programming language. One in partiucular, Mauro Cicio, moved from our small hillside town Perugia to Berlin and placed there his IT businness mainly based on Ruby development and Ruby on Rails, the web framework written in Ruby. I remember very well the enthusiasm of Mauro about telling how Ruby language was even more fun than Python. More fun than Python? how can a language be more fun than a language which is the funniest to use?
So the years passed and I became a researcher. As I get older, I found in Python more and more fun. This is mainly due to the fact that Python was first developed for children, and it is well know that the older you are the more child-like you become!
Last year, my beloved Angela and me, had a great fun in our trip to Japan. Angela has always been attracted by the japanese culture, and trailed me in this physical and cultural journey.
Guess where the Ruby language was developed first? Yes, you got it! Ruby was developed by Yukihiro “Matz” Matsumoto in Japan, in the 1990s. Ruby was associated with the geeky acronym MINASWAN “Matz Is Nice And So We Are Nice”. This motto expresses the concept of being part of a whole which is embedded in japanese culture.
I don’t really know if Ruby is better or worse than this or that. I get some steps into Ruby as a cultural journey. As Guido Von Rossum’s sense of Humor affected almost all the python programmers, I’m sure also Ruby has got something to say.
Let’s start the journey.
Getting the rail ticket: The Ruby Language
Starting point is Ruby: a programmer’s best friend. Main statements are promising, Ruby main points are:
- dynamic language
- open source programming language
- elegant syntax
- natural to read
- easy to write
Also I notice Ruby is still alive, version 2.6.0 has been brought by Santa on Dec 25th, 2018.
Let’s check the version on my machine:
ruby -v ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
I think I can stick with this for now. Let’s jump on that train
Stepping on the train.
The documentation section of the Ruby site is quite varied. Since this is a cultural trip into the language, I pick the Ruby Koans.
According to Wikipedia, a koan is a story, dialogue, question, or statement which is used in Zen practice to provoke the “great doubt” and to practice or test a student’s progress in Zen.
Testing is not just something we pay lip service to, but something we live
I agree completely.
In order to use the koans we need rake as well. rake is a task management and
rake --version rake, version 12.3.1
Basically the koans are posing you in front of piece of code which have some kind of problem or you have to fill in the blanks.
The koans are the path to the Ruby elightment.
/usr/bin/ruby2.5 path_to_enlightenment.rb AboutObjects#test_every_object_has_an_id has damaged your karma. The Master says: You have not yet reached enlightenment. Do not lose hope. The answers you seek... Expected "FILL ME IN" to equal Integer Please meditate on the following code: koans/about_objects.rb:24:in `test_every_object_has_an_id' learn the rules so you know how to break them properly your path thus far [.X________________________________________________] 11/282
Learning a completely new language by errors seems weird at first, but it makes a lot of sense as you walk along the path. It is enjoyable as it avoids running through lot of sequential documentation which can be easly disrupted.
One koan a time seems just right.