Search
Follow
Recent Comments

Entries in ruby (2)

Thursday
Nov112010

Programming Ruby - The PickAxe Book

I am guessing that anybody who has even a passing interest in Ruby or Ruby On Rails probably owns the original Programming Ruby book (otherwise known as the PickAxe book) from Pragmatic Programmers. So I was pleased to see today that they have a special offer on the latest edition of Programming Ruby 1.9.

I have the original Programming Ruby version which covered ruby 1.8 and along with The Ruby Way it pretty much covers all my Ruby reference needs. I have been meaning to buy the upgrade to the new edition for a while but I never got around to it. The book has just been updated to cover ruby 1.9.2 and to celebrate 10 years since publication of the original version Pragmatic are offering the book for just $10 in either eBook or dead tree versions.

I always go for the eBook versions from Pragmatic as they are formatted really well. I use the pdf version to read from the computer and the ePub version to read on the iPhone using Stanza. The book normally sells for $25 so getting it for $10 is a bargain especially if you do not own the original (Pragmatic offer an upgrade from the previous version for $12.50 so the saving is not as big as it first seems for me).

It does not say how long the offer will last so if you are interested I would suggesting getting it while you can…

Tuesday
Sep282010

Design Patterns in Ruby

I just finished reading Design Patterns in Ruby and think it is worth a mention even if you are a dedicated iPhone developer. If you are regular Ruby developer you should definitely check it out. I should clarify that when I say I read this book I really do mean I read it from cover to cover which is not something I can normally say for a book on software.

I mentioned the excellent Cocoa Design Patterns books a while ago which looks at common design patterns in the Cocoa frameworks. This book takes a slightly different perspective in that it focuses on 14 of the classic software design patterns from the so called “Gang of Four” book - Design Patterns: Elements of Reusable Object-Oriented Software. This latter book has a reputation for not being an easy read whereas Design Patterns in Ruby is very well written by Russ Olsen.

The design patterns that the book discusses are as follows:

  • Template Method
  • Strategy
  • Observer
  • Composite
  • Iterator
  • Command
  • Adapter
  • Proxy
  • Decorator
  • Singleton
  • Factory Method
  • Abstract Factory
  • Builder
  • Interpreter

The patterns that are not included are generally those that do not find frequent use in Ruby. In addition, in a section that is much closer to the Cocoa Design Patterns book there are three additional chapters on patterns that are very common in Ruby:

  • Internal Domain-Specific Language (DSL)
  • Meta-programming
  • Convention Not Configuration

The book is written in a very readable style and I found it really increased by understanding of Ruby but also of when and how to apply common patterns in any language. The description of the Observer pattern for example is very easy to apply to the typical iPhone or Cocoa application.

I should also mention that the book starts with some good general advice on OO design and also a warning not to abuse design patterns by using them when it is not appropriate. Basically a design pattern is intended to solve a specific problem, applying a pattern to your code because you just read a pattern book and you want to try it out is likely to cause you some grief.

In Summary

If you have any interest in Ruby you should check this book out. Like the Cocoa Design Patterns book it is not an introductory book but if you are coming to Ruby from another language such as Java or Objective-C it can help you to start thinking the Ruby way.