REVIEW - Effective Ruby - Live Lessons

Title:

Effective Ruby - Live Lessons

Author:

Sam Phippen, Peter J. Jones and Scott Meyers

ISBN:

9780134175379

Publisher:

Addison-Wesley Professional ()

Pages:

Reviewer:

Ian Bruntlett

Reviewed:

February 2018

Rating:

★★★☆☆

Reviewed: September 2017

If you are already familiar with Ruby, skip this paragraph. The first thing you do regarding Ruby is to visit www.ruby-lang.org/en/documentation/ so you can play around with it to see if it suits you. The first detailed book to read about Ruby would have to be The Ruby Programming Language by Flanagan and Matsumoto, but this only covers Ruby 1.8 and 1.9. I figure that the Ruby language is changing so much that books and videos are like booster rockets. They can be used to get you off the ground but, once in orbit, you find that you rely on the main Ruby websites: www.rubylang.org and ruby-doc.org/.

The bad news. The videos lack a detailed listing of contents and time offsets of subsections. Knowing which lesson is at which point in a video file and how long that lesson is would have saved me a lot of time. During the course of this review, I have created a detailed contents listing. The quality of the video footage of vim being used to edit and run Ruby programmes isn’t too good. For example the [] operator looks like a square box when viewed in the first chapter. It would have been helpful if the screen was used more intelligently – in particular, showing an example’s source code alongside its output would have been particularly helpful. Showing the filename of the example would have made life easier as well (later examples do show the filename and initial directory).

Ruby has more than its fair share of quirks. This is where this set of videos comes in handy. It complements the other books and websites quite well but should be regarded as a booster rocket.

These videos also rely on third party modules for Ruby (colloquially known as ‘gems’). You’ll be needing to be familiar with Gems and how to install them. On Linux, the command man gem will get you so far. Then you’ll need to visit the website rubygems.org. When you have downloaded the example code of these lessons, there will be files ending in .rb – they’re the examples and there will be a file called Gemfile that lists the external dependencies of the example files.

Another useful resource is ri. On Ubuntu Linux, the ri command is installed along with Ruby. However, the information pages for Ruby are in a separate package, rubyn.n.doc, where n.n are the major and minor version numbers of the Ruby interpreter you are using.

The video files are O.K. – there are 5 of them but it would have been very helpful if they’d supplied an overview of their contents, along with time offsets so that people could jump to a particular point when needed.

One of the problems that happen when learning a new programming language on your own is that you don’t get to see production code or find out about the ‘gotchas’ of the language you are learning. From that point of view, these videos are invaluable as it provides both.

I am still learning Ruby so, rather than relying on my opinion of individual items, I’ll give a brief overview of each lesson. All languages have ‘gotchas’ and Ruby is no exception – these videos point out some of Ruby’s gotchas.

Lesson 1 – Arrays and Hashes [38 minutes]. This is a reasonably gentle start and not too long. I am not sure why ‘Arrays’ is in the lesson title – as well as Hashes it covers preserving object encapsulation, using Set instead of Hash and an item on delegation that is useful if you have a class with a hash that you want to partially expose to the users of your class.

Lesson 2 – Seams [37 minutes]. This lesson deals with writing your code to make refactoring easier, later on in life when your system need improving. Some things I slightly disagree with but I cannot dispute the fact that the advice provided here, used rationally, is really important.

Lesson 3 – Testing [42 minutes]. I am using these videos to expand my Ruby knowledge and with this lesson I haven’t typed in all the examples and tested them. However, I found this lesson to be particularly useful in showing to me lots of things I wasn’t aware of. It answered some unanswered questions that I had about how to test Ruby applications.

Lesson 4 - Enumerables and Callables [1 hour and 25 minutes]. This is a long lesson, but important. Item 17 covers Enumerables and Callables, noteworthy features of Ruby. As mentioned earlier, you really need to read The Ruby Programming Language and that is especially true of this lesson. This lesson will take you far further than the use of #each.

Lesson 5 – The Standard Library [34 minutes]. In general, it is best to use Ruby’s Standard Library. It will have less bugs than handwritten code and, if used wisely, will handle platform specific quirks, and may offer better performance. It covers the use of block forms to avoid failing to close files when an exception is raised, a little bit of Net::HTTP and describes how to use the File module’s functions for manipulating file and path names.

There is a web page on www.informit.com for these videos – search for “effective ruby livelessons” and you should find it. That page will let you buy a digital download copy of the lessons and has a link to the Ruby source code files for the videos.

Now you have a reasonable idea of what this video course offers. Have fun :)


Book cover image courtesy of Open Library.