# Design patterns

**URL:** <https://rubytalk.org/t/design-patterns/45218>\
**Category:** ruby-talk\
**Created:** [16 March 2008 12:25 UTC](https://rubytalk.org/t/design-patterns/45218 "2008-03-16T12:25:12Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Mendler](https://avatars.discourse-cdn.com/v4/letter/d/edb3f5/32.png) [@Daniel\_Mendler](https://rubytalk.org/u/Daniel_Mendler)\
**Post date:** [16 March 2008 12:25 UTC](https://rubytalk.org/t/design-patterns/45218/1 "2008-03-16T12:25:12Z")

</div>

Hi,

are there some good tutorials or references about design patterns in ruby, which talk about mixins etc? I would really appreciate one because ruby is quite different from other languages (and more flexible) concerning oop.

I found a lot of modules using nested submodules like ClassMethods and InstanceMethods. Is there a kind of ruby standard for such things?

Daniel

---

<div class="post-metadata">

**Author:** ![James\_Edward\_Gray\_II](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@James\_Edward\_Gray\_II](https://rubytalk.org/u/James_Edward_Gray_II)\
**Post date:** [16 March 2008 15:57 UTC](https://rubytalk.org/t/design-patterns/45218/2 "2008-03-16T15:57:19Z")

</div>

I really enjoyed this book on the subject:

> **[Gray Soft / Not Found](http://graysoftinc.com/articles/design_patterns_in_ruby)**
>
> Something has gone wrong.

James Edward Gray II

> **···**
>
> On Mar 16, 2008, at 7:25 AM, Daniel Mendler wrote:
> 
> > are there some good tutorials or references about design patterns in ruby, which talk about mixins etc?

---

<div class="post-metadata">

**Author:** ![Mikkel\_Bruun1](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@Mikkel\_Bruun1](https://rubytalk.org/u/Mikkel_Bruun1)\
**Post date:** [16 March 2008 18:51 UTC](https://rubytalk.org/t/design-patterns/45218/3 "2008-03-16T18:51:19Z")

</div>

James Gray wrote:

> **···**
>
> > On Mar 16, 2008, at 7:25 AM, Daniel Mendler wrote:
> > 
> > > are there some good tutorials or references about design patterns in  
> > > ruby, which talk about mixins etc?
> > 
> > I really enjoyed this book on the subject:
> > 
> > [Gray Soft / Not Found](http://blog.grayproductions.net/articles/design_patterns_in_ruby)
> > 
> > James Edward Gray II
> 
> did you enjoy writing or reading it??? 🙂
> 
> Mikkel  
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Jari\_Williamsson](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@Jari\_Williamsson](https://rubytalk.org/u/Jari_Williamsson)\
**Post date:** [16 March 2008 19:24 UTC](https://rubytalk.org/t/design-patterns/45218/4 "2008-03-16T19:24:06Z")

</div>

James Gray wrote:

> **···**
>
> > On Mar 16, 2008, at 7:25 AM, Daniel Mendler wrote:
> > 
> > > are there some good tutorials or references about design patterns in ruby, which talk about mixins etc?
> > 
> > I really enjoyed this book on the subject:
> > 
> > [Gray Soft / Not Found](http://blog.grayproductions.net/articles/design_patterns_in_ruby)
> 
> +1 for this book (and I agree with the blog review). A great read and quite different approach to most other books on Ruby.
> 
> The only time I found myself disagreeing with the book's author was regarding the suggested solution on to how to test the Singleton pattern.
> 
> Best regards,
> 
> Jari Williamsson

---

<div class="post-metadata">

**Author:** ![Julian\_Leviston](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@Julian\_Leviston](https://rubytalk.org/u/Julian_Leviston)\
**Post date:** [31 March 2008 01:18 UTC](https://rubytalk.org/t/design-patterns/45218/5 "2008-03-31T01:18:44Z")

</div>

Yeah, the book is okay, but it doesn't have all the patterns of the GOF book, and some of the Ruby is really irksome... and sometimes it's just wrong!

Julian.

> **···**
>
> On 17/03/2008, at 2:57 AM, James Gray wrote:
> 
> > On Mar 16, 2008, at 7:25 AM, Daniel Mendler wrote:
> > 
> > > are there some good tutorials or references about design patterns in ruby, which talk about mixins etc?
> > 
> > I really enjoyed this book on the subject:
> > 
> > [Gray Soft / Not Found](http://blog.grayproductions.net/articles/design_patterns_in_ruby)
> > 
> > James Edward Gray II

---

<div class="post-metadata">

**Author:** ![Rolando\_Abarca](https://avatars.discourse-cdn.com/v4/letter/r/5daacb/32.png) [@Rolando\_Abarca](https://rubytalk.org/u/Rolando_Abarca)\
**Post date:** [16 March 2008 19:24 UTC](https://rubytalk.org/t/design-patterns/45218/6 "2008-03-16T19:24:49Z")

</div>

the writer of the book is Russ Oslen, James is the writer of the review 🙂

> **···**
>
> On Mar 16, 2008, at 2:51 PM, Mikkel Bruun wrote:
> 
> > did you enjoy writing or reading it??? 🙂
> > 
> > Mikkel  
> > -- Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
> 
> --  
> Rolando Abarca M.

---

<div class="post-metadata">

**Author:** ![Thomas\_Wieczorek](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@Thomas\_Wieczorek](https://rubytalk.org/u/Thomas_Wieczorek)\
**Post date:** [17 March 2008 00:51 UTC](https://rubytalk.org/t/design-patterns/45218/7 "2008-03-17T00:51:00Z")

</div>

It's a great book. I bought it and read it in about two days.

> **···**
>
> On Sun, Mar 16, 2008 at 7:51 PM, Mikkel Bruun \<mikkel@helenius.dk\> wrote:
> 
> > did you enjoy writing or reading it??? 🙂

---

<div class="post-metadata">

**Author:** ![Shin\_guey\_Wong](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@Shin\_guey\_Wong](https://rubytalk.org/u/Shin_guey_Wong)\
**Post date:** [31 March 2008 16:46 UTC](https://rubytalk.org/t/design-patterns/45218/8 "2008-03-31T16:46:06Z")

</div>

Julian Leviston wrote:

> Yeah, the book is okay, but it doesn't have all the patterns of the  
> GOF book, and some of the Ruby is really irksome... and sometimes it's  
> just wrong!
> 
> Julian.

Can you point out which pattern in the book is wrong with Ruby? I never  
read the GOF book. This is the first Design Pattern book I read, I  
really want to know which pattern seems wrong. For me, everything look  
nice and it is a good book for me.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![James\_Edward\_Gray\_II](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@James\_Edward\_Gray\_II](https://rubytalk.org/u/James_Edward_Gray_II)\
**Post date:** [16 March 2008 23:08 UTC](https://rubytalk.org/t/design-patterns/45218/9 "2008-03-16T23:08:28Z")

</div>

Sorry if I didn't make that clear. I linked to my review in the hope that it would provide more detail about what was in the book.

James Edward Gray II

> **···**
>
> On Mar 16, 2008, at 2:24 PM, Rolando Abarca wrote:
> 
> > On Mar 16, 2008, at 2:51 PM, Mikkel Bruun wrote:
> > 
> > > did you enjoy writing or reading it??? 🙂
> > > 
> > > Mikkel  
> > > -- Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
> > 
> > the writer of the book is Russ Oslen, James is the writer of the review 🙂

---

<div class="post-metadata">

**Author:** ![Todd\_Benson](https://avatars.discourse-cdn.com/v4/letter/t/34f0e0/32.png) [@Todd\_Benson](https://rubytalk.org/u/Todd_Benson)\
**Post date:** [31 March 2008 17:01 UTC](https://rubytalk.org/t/design-patterns/45218/10 "2008-03-31T17:01:03Z")

</div>

From the horse's mouth...

> **[Russ Olsen Interview](http://on-ruby.blogspot.com/2008/01/russ-olsen-interview.html)**
>
> Welcome InformIT readers!  You might also like to see my review of Eloquent Ruby .  Enjoy! With the popularity of my recent review of De...

I'm going out to buy it today, so I hope it isn't as bad as Julian  
suggests. I don't have a problem if some of the code doesn't work  
perfectly, since I distrust most of the code I look at anyway 🙂

Todd

> **···**
>
> On Mon, Mar 31, 2008 at 11:46 AM, Shin guey Wong \<sgwong513@hotmail.com\> wrote:
> 
> > Julian Leviston wrote:  
> > \> Yeah, the book is okay, but it doesn't have all the patterns of the  
> > \> GOF book, and some of the Ruby is really irksome... and sometimes it's  
> > \> just wrong!  
> > \>  
> > \> Julian.
> > 
> > Can you point out which pattern in the book is wrong with Ruby? I never  
> > read the GOF book. This is the first Design Pattern book I read, I  
> > really want to know which pattern seems wrong. For me, everything look  
> > nice and it is a good book for me.

---

<div class="post-metadata">

**Author:** ![Chuck\_Remes](https://avatars.discourse-cdn.com/v4/letter/c/3be4f8/32.png) [@Chuck\_Remes](https://rubytalk.org/u/Chuck_Remes)\
**Post date:** [31 March 2008 21:26 UTC](https://rubytalk.org/t/design-patterns/45218/11 "2008-03-31T21:26:04Z")

</div>

I bought this book about a week ago and absolutely love it. I have the original GoF book, but this is a fantastic companion to it. Russ' writing style is very informal which I like. I have found it very easy to understand his text and examples.

I haven't found any obvious design problems with his code. I would point out that his example of the Strategy Pattern is a bit lacking. Oftentimes the strategy will either get a large set of parameters handed to it in the initializer/constructor OR it will pass a copy of :self. (Obviously passing :self leads to a lot of tight coupling between the objects; that detail is also left out of the discussion too.) He only covered the former case where parameters are passed to the strategy. This is a minor oversight in my opinion.

I recommend this book.

cr

> **···**
>
> On Mar 31, 2008, at 11:46 AM, Shin guey Wong wrote:
> 
> > Julian Leviston wrote:
> > 
> > > Yeah, the book is okay, but it doesn't have all the patterns of the  
> > > GOF book, and some of the Ruby is really irksome... and sometimes it's  
> > > just wrong!
> > > 
> > > Julian.
> > 
> > Can you point out which pattern in the book is wrong with Ruby? I never  
> > read the GOF book. This is the first Design Pattern book I read, I  
> > really want to know which pattern seems wrong. For me, everything look  
> > nice and it is a good book for me.

---

<div class="post-metadata">

**Author:** ![Guest15](https://avatars.discourse-cdn.com/v4/letter/g/6de8d8/32.png) [@Guest15](https://rubytalk.org/u/Guest15)\
**Post date:** [17 March 2008 05:43 UTC](https://rubytalk.org/t/design-patterns/45218/12 "2008-03-17T05:43:34Z")

</div>

> \>  
> \>\>\>  
> \>\> did you enjoy writing or reading it??? 🙂  
> \>\>  
> \>\> Mikkel  
> \>\> -- Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).  
> \>  
> \>  
> \> the writer of the book is Russ Oslen, James is the writer of the  
> \> review 🙂
> 
> Sorry if I didn't make that clear. I linked to my review in the hope  
> that it would provide more detail about what was in the book.

I also enjoyed the book, I've reviewed it too, I also interviewed  
Russ and talked a bit about it:

&nbsp;&nbsp;&nbsp;[On Ruby: Russ Olsen Interview](http://on-ruby.blogspot.com/2008/01/russ-olsen-interview.html)

> **···**
>
> On Sun, Mar 16, 2008 at 5:08 PM, James Gray \<james@grayproductions.net\> wrote:
> 
> > On Mar 16, 2008, at 2:24 PM, Rolando Abarca wrote:  
> > \> On Mar 16, 2008, at 2:51 PM, Mikkel Bruun wrote:
> 
> > James Edward Gray II
> 
> --  
> thanks,  
> -pate  
> -------------------------  
> Duty makes us do things, Love make us do things well.  
> [http://on-ruby.blogspot.com](http://on-ruby.blogspot.com) [http://on-erlang.blogspot.com](http://on-erlang.blogspot.com)  
> [http://on-soccer.blogspot.com](http://on-soccer.blogspot.com)
