Day 1 -- Ruby
Day 1 -- Ruby
Join the DZone community and get the full member experience.Join For Free
When I decided to blow through "Seven Languages in Seven Weeks " in only 7 days, I had yet to read even the introduction to the book. I can tell now that Bruce might prefer that I not do it this way, and I have to admit it would truly be a focused experience to do all the suggested exercises on each language, spending only one day on each. But... I'm on a schedule, and I'm not pretending to come out of this with the level of understanding that he aims to cultivate. At least not on this first run through the book.
First, some notes about his introduction. Bruce describes up-front how he'll contrast the different languages: the typing model, programming model, language constructs, data structures, and any other features that distinguish a language. I really like this set of abstractions, and the simple fact that he lists and describes them before launching into the first language. He also says he's not going to burn space describing how to download and set up each language's environment, thus allowing him to focus on the language itself. It's nice to see a book with this much thought put into it.
The first language, Ruby, appears to be the language (of these 7) in which he is strongest. I left scientific development for business development quite a few years ago, at which point I was rather proficient with Perl (version 4, to tell you how long ago that was). Since then I've been immersed mostly in Java and C# on Windows . I've always thought that it would be cool to pick up Ruby, but have never got around to it. Finally, I'm spending one day on it. :)
Bruce starts by sharing his interview with Yukihiro Matsumoto, the creator of Ruby (nice touch), then talks about Ruby's pure-object-oriented typing model. After using Java for 14 years, it's refreshing to be able to call a method on what appears to be the numeral 4! ;-> Ruby is (mostly) strongly-typed, but also dynamically typed. He then covers function definition, collections, code blocks, classes, and mixins. And this is just by the end of the 2nd day of the week he allots to studying Ruby. This is just my opinion, of course, but it's not often I've seen someone so proficient at introducing relevant features of a language in an order that is so intuitive -- and useful -- to an experienced developer looking to evaluate a new language.
Day 3 of the Ruby chapter talks about Ruby support for metaprogramming, including open classes and modules. Here is where you can start to see Bruce's depth of knowledge about Ruby. He concludes the Ruby discussion with sections on the strengths and weaknesses of Ruby vs other languages.
In the interest of finishing in one day, I sped over most of the hands-on training. Following along and doing the suggested exercises would indeed fill a whole week, comfortably. I like this chapter so much that when the day comes for me to finally really pick up Ruby, I'm sure I'll actually start with this chapter.
Opinions expressed by DZone contributors are their own.