Ruby design patterns and idioms


#1

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


#2

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:

http://www.rubygarden.org/ruby?ExampleDesignPatternsInRuby

James Edward G. II


#3

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/
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://c2.com/cgi/wiki?search=ruby

and the draft ORA ruby cookbook looks very promising


#4

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/

Smalltalk books should have interesting reading, too:

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)

#5

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:
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:
http://kallokain.blogspot.com/2006/01/ruby-refactorings.html.

/Henrik


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


#6

On 2/7/06, Jack C. 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