# Ruby design patterns and idioms

**URL:** <https://www.ruby-forum.com/t/ruby-design-patterns-and-idioms/101849>\
**Category:** Ruby\
**Created:** [February 7, 2006, 2:03am UTC](https://www.ruby-forum.com/t/ruby-design-patterns-and-idioms/101849 "2006-02-07T02:03:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![giaco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a3d4f5/32.png) [@giaco](https://www.ruby-forum.com/u/giaco)\
**Post date:** [February 7, 2006, 2:03am UTC](https://www.ruby-forum.com/t/ruby-design-patterns-and-idioms/101849/1 "2006-02-07T02:03:54Z")

</div>

I’ve read Design Patterns and similar material. While I’ve certainly  
picked up some good ideas, it seems that most of the techniques are  
simply the normal ruby way, or are only necessary for lower level  
languages and aren’t applicable.

There are a lot of really useful things that can be done with  
method\_missing, duck-typing, closures, reflection, all the  
metaprogramming stuff, etc. Most of what I understand of that comes from  
looking through the source of ruby projects.

Are there any books or other resources on design patterns or techniques  
specific to dynamic languages?

Jack

---

<div class="post-metadata">

**Author:** ![giaco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a3d4f5/32.png) [@giaco](https://www.ruby-forum.com/u/giaco)\
**Post date:** [February 7, 2006, 2:16am UTC](https://www.ruby-forum.com/t/ruby-design-patterns-and-idioms/101849/2 "2006-02-07T02:16:17Z")

</div>

On Feb 6, 2006, at 7:01 PM, Jack C. wrote:

> Are there any books or other resources on design patterns or  
> techniques specific to dynamic languages?

See if this gets you going:

> **[WebMD - Better information. Better health.](https://www.webmd.com/?ExampleDesignPatternsInRuby)**
>
> The leading source for trustworthy and timely health and medical news and information. Providing credible health information, supportive community, and educational services by blending award-winning expertise in content, community services, expert...

James Edward G. II

---

<div class="post-metadata">

**Author:** ![giaco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a3d4f5/32.png) [@giaco](https://www.ruby-forum.com/u/giaco)\
**Post date:** [February 7, 2006, 4:54am UTC](https://www.ruby-forum.com/t/ruby-design-patterns-and-idioms/101849/3 "2006-02-07T04:54:32Z")

</div>

Jack C. wrote:

> Are there any books or other resources on design patterns or techniques  
> specific to dynamic languages?
> 
> Jack

i mostly search this mail list but:

the facets and extensions libs, ruby tricks-R-us

[http://redhanded.hobix.com/](http://redhanded.hobix.com/)  
and why’s links below the picture of the pickax on the right, prolly  
take a fe wmonths to work thru ;-}

c2 and [artima.com](http://artima.com)  
[http://c2.com/cgi/wiki?search=ruby](http://c2.com/cgi/wiki?search=ruby)

and the draft ORA ruby cookbook looks very promising

---

<div class="post-metadata">

**Author:** ![giaco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a3d4f5/32.png) [@giaco](https://www.ruby-forum.com/u/giaco)\
**Post date:** [February 7, 2006, 5:33am UTC](https://www.ruby-forum.com/t/ruby-design-patterns-and-idioms/101849/4 "2006-02-07T05:33:58Z")

</div>

Gene T. wrote:

> Jack C. wrote:
> 
> > Are there any books or other resources on design patterns or techniques  
> > specific to dynamic languages?
> > 
> > Jack

This may have already been mentioned, but:

[http://norvig.com/design-patterns/](http://norvig.com/design-patterns/)

Smalltalk books should have interesting reading, too:

[http://www.iam.unibe.ch/~ducasse/FreeBooks.html](http://www.iam.unibe.ch/~ducasse/FreeBooks.html)

–  
James B.

“Programs must be written for people to read, and only incidentally  
for machines to execute.”

- H. Abelson and G. Sussman  
(in "The Structure and Interpretation of Computer Programs)

---

<div class="post-metadata">

**Author:** ![giaco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a3d4f5/32.png) [@giaco](https://www.ruby-forum.com/u/giaco)\
**Post date:** [February 7, 2006, 6:52am UTC](https://www.ruby-forum.com/t/ruby-design-patterns-and-idioms/101849/5 "2006-02-07T06:52:33Z")

</div>

On Tue, 2006-02-07 at 02:01, Jack C. wrote:

> Are there any books or other resources on design patterns or techniques  
> specific to dynamic languages?

Here is a description of a refactoring I found useful awhile ago:  
[Kallokain: Refactoring: Extract Mixin](http://kallokain.blogspot.com/2006/01/refactoring-extract-mixin.html).

There is another, “Replace Mixin With Class”, but I haven’t made a  
writeup of that one yet. (I will, its just that I am up to my eyebrows  
in other projects right now.)

Those two refactorings together where useful in cleaning up  
Test::Unit::XML a bit. You can read about it here:  
[Kallokain: Ruby Refactorings](http://kallokain.blogspot.com/2006/01/ruby-refactorings.html).

/Henrik

–  
[http://kallokain.blogspot.com/](http://kallokain.blogspot.com/) - Blogging from the trenches of software  
development  
[http://www.henrikmartensson.org/](http://www.henrikmartensson.org/) - Reflections on software development  
[http://testunitxml.rubyforge.org/](http://testunitxml.rubyforge.org/) - The Test::Unit::XML Home Page  
[http://declan.rubyforge.org/](http://declan.rubyforge.org/) - The Declan Home Page

---

<div class="post-metadata">

**Author:** ![giaco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a3d4f5/32.png) [@giaco](https://www.ruby-forum.com/u/giaco)\
**Post date:** [February 7, 2006, 6:28am UTC](https://www.ruby-forum.com/t/ruby-design-patterns-and-idioms/101849/6 "2006-02-07T06:28:16Z")

</div>

On 2/7/06, Jack C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Are there any books or other resources on design patterns or techniques  
> specific to dynamic languages?

I have an old issue of Dr. Dobb’s Journal (August 1997), that has an  
article entitled: “Dynamic Design Patterns in Objective-C: Dynamic run  
times affect how programs are designed and built”. While the article  
focuses mainly on Objective-C and gives some examples from the  
NeXTStep Runtime (today in use as Mac OS X’s Cocoa), the dynamic  
runtime of Objective-C is sufficiently similar to Ruby’s that many of  
the same principles apply. Apparently, the full text of the article  
is available here:

[http://202.179.135.4/data/DDJ/articles/1997/9708/9708d/9708d.htm](http://202.179.135.4/data/DDJ/articles/1997/9708/9708d/9708d.htm)
