A review of Ruby Best Practices

Introduction #

Ruby Best Practices is the latest book of a Ruby-related series I have read in the past weeks. In this period, I’m focusing myself on learning real Ruby, I mean there is a big difference between using Ruby to write code and coding in Ruby to solve problems. I think I’m on the right path to master Ruby and a big part of my recent improvements derives from reading books. In the following weeks I’m going to review all the Ruby-related books I have recently read as a way to give back to the community and as a way to wrap-up what I learnt.

The book #

Ruby Best Practices is well-organized and it covers many interesting aspects of the Ruby programming world. I think the main aim of the book was to offer an optimal introduction into how a problem can be well solved and how Ruby should be used to solve it. In my opinion, the book is well-written and the aim is respected throughout most chapters. One of the most interesting aspects of this book is the complete independence of the topics covered in the chapters, in fact you could simply read only the ones that interest you and I consider it a good point.

My consideration grouped by chapter:

  • Driving Code Through Test

    The first chapter is one of my favourites. Unfortunately, I work in a country where there is no culture about tests. I really liked the examples presented, this chapter helped me to understand better how to write fine tests.

  • Designing Beautiful APIs

    The concepts behind the topics covered in this chapter deserve more than a chapter. This aspect of programming can be very important especially while using Ruby, when you are new to it you often feel you are using it without understanding its true beauty. You write Ruby code but you don’t speak Ruby yet. Then, you need something that puts you on the right path to speak this wonderful language. This chapter can help you to enter the path because it is full of great advice about how APIs can be written. The examples about parameters is the most interesting part of the chapter.

  • Mastering The Dynamic Toolkit

    This is the most difficult chapter to read but, in spite of that, it is one of the most interesting parts of the book. Surely it is one of those you shouldn’t miss. If you are relatively new to Ruby you’ll enjoy it because Gregory Brown covers the “meta” side of Ruby in it. In my opinion, this is the most notable aspect of Ruby that makes it wonderful.

  • Text Processing File Management

    I have to be honest, I didn’t like this chapter. I don’t get the point of it. Maybe it’s my problem, I don’t know, but after two wonderful chapters I started reading this one with great expectations for the topic I really like, and I got a bit disappointed when I found out I didn’t like the chapter.

  • Functional Programming Techniques

    Generally speaking, functional programming is not a simple programming topic out there but this book covers it in a very nice way and offers to the reader many interesting examples and pieces of code about this techniques.

  • When Things Go Wrong

    Yes, I know that a book about best practices must contain a chapter about debugging and I agree with that. However, I think it is not so a Ruby-related topic, It’s a more general topic that deserves even more than a chapter in a book. That’s why I wouldn’t expect to find it in a Ruby book, just saying:) By the way, I read this chapter and it’s worth reading because you can find good advice anyway.

  • Reducing Cultural Barriers

    I have to be honest here too. For the most part I didn’t read this chapter. I have to read too many books in my life so I tend to read only things I really care about. Thus, I can’t express a complete opinion about this chapter but surely you should read it if you care about the specific topic.

  • Skillful Project Maintenance

    The idea behind this chapter is a good one. It is a bit unusual to read why a real project like haml can be considered maintainable. This chapter will enlighten you on generally badly covered aspects of the reason behind a good project. You should read it.
    Furthermore, the book comes with three nice appendixes and I really liked the first one. It is about writing backward-compatible code and I have to say that I didn’t know much about this particular problem. This appendix helped me a lot. I found the other two appendixes less interesting but still very enjoyable if you care about the topics covered.

What I liked most #

I have a general good opinion of this book. It has several good aspects and above all it offers a very good approach to Ruby programming and to problem solving. While reading the book I found out nice things about Ruby and Ruby libraries and this is the aspect of the book I enjoyed a lot.

What I disliked most #

There are a few aspects I disliked in the book. If I have to be critic about it I would say it covers aspects of programming that I consider neither Ruby-related nor “Best Practices” but, obviously, it is just an opinion. However, you should read it if you care about Ruby.