Effective Ruby

Author: Peter J. Jones
Publisher: Addison Wesley
Pages: 240
ISBN:  978-0133846973
Print: 0133846970
Kindle: B00NEOERH6
Audience: Intermediate Ruby Programmers
Rating: 5 
Reviewer: Alex Armstrong

Over the festive season IProgrammer asks its reviewers to recommend books that are worth a second look in case you missed them. Alex Armstrong nominated one of the most enjoyable books on Ruby. 

We all want to write effective Ruby so does this book help?

The answer depends what you mean by "effective". This book, and others in the same series that I've read, seems to take the remit to be explaining some of the darker corners of whatever language the book deals with. This might not be what you think of when you think of writing effective Ruby. There is an argument that really the best way to write any language effectively is to steer well clear of exactly these dark corners. You should write code that is clear and simple and if you do this then you are unlikely to encounter any of the 48 "problems" outlined in this book. 

However.... there is a huge fascination in delving into the darker corners of a language. Why? The answer is obvious. It is a way of finding out how much you know and expanding your knowledge at the same time. Put another way - it can be both fun and instructive. 

Chapter 1 starts off with some general topics. What is true - as in the value true and it turns out everything but 0. Dealing with null objects, cryptic "Perlisms", constants and runtime warnings are the other topics. This first chapter sets the scene and, if you are like me, you start to thing about Ruby's approach to doing things in an obvious way - not so obvious sometimes. 

Next we move on to something that most programmer find difficult - Classes, Object and Modules. This digs fairly deep into the way Ruby uses classes - which are really prototype objects. It explains how modules differ from classes and why Ruby's inheritance isn't really multiple inheritance. 

Chapter 3 is about collections which isn't exactly core language but it is core from the point of view of usage. This is more in the spirit of how best to do things rather than strange language quirks. It sets forth ways you should do things to get best performance or best code. 

The next chapter is exceptional - no really, its about exceptions. My guess is that everyone knows what an exception is and few know how to use it. This is a discussion of how to handle exceptions and its worth reading. 

 

Banner

 

From this point on the book moves a bit off topic away from language details and even the core libraries into slightly more general topics. The first is metaprogramming which Ruby is very good at. This is good but you need to remember that there are whole books devoted to Ruby and metaprogramming so it isn't going very deep. Chapter 6 is on testing and this is just a Ruby specific unit testing discussion - still worth reatind. Chapter 7 moves on to tools and libraries - documentation Gem dependencies and so on. Chapter 8 is about memory management and performance - garbage collection, Finalizers, profiling and so on. 

This brings the book to a close. 

 

 

Overall the book is well written in a gentle and easy-to-read style. 

This isn't so much a book about writing effective Ruby code as understanding Ruby and its environment better. It is full of interesting discussion of Ruby's sometimes strange ways of doing things and about facilities that you might have over looked. I don't think that this will improve your Ruby style much, but it is an enjoyable read if you are reasonably good at Ruby.

It isn't an essential book, but you are missing some fun if you don't read it to find out how much you really know about Ruby. 

 

For more recommendations of Ruby books see Gems Amongst Ruby Books on our Programmers Bookshelf

 

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

Banner


Machine Learning with PyTorch and Scikit-Learn

Author: Sebastian Raschka, Yuxi (Hayden) Liu & Vahid Mirjalili
Publisher: Packt
Date: February 2022
Pages: 770
ISBN: 978-1801819312
Print: 1801819319
Kindle: B09NW48MR1
Audience: Python developers interested in machine learning
Rating: 5
Reviewer: Mike James
This is a very big book of machine le [ ... ]



C# Programming, 3rd Ed (In Easy Steps)

Author: Mike McGrath
Publisher: Easy Steps
Date: April 2022
Pages: 192
ISBN: 978-1840789737
Print: 1840789735
Kindle: B09WPBZZCV
Audience: C# developers
Rating: 5
Reviewer: Mike James
An easy guide to C# - what could be better.


More Reviews

 

Last Updated ( Wednesday, 28 December 2016 )