From: Rick DeNatale Date: 2007-10-03T01:38:49+09:00 Subject: Re: Confession: I never learned CS On 9/28/07, Robert Dober wrote: > On 9/27/07, Rick DeNatale wrote: > > > I've got to agree here. I am/was friends with all four of the GOF and > > I hope that the three survivors won't be offended, but it's really a > > C++ book, and I fear that it has done as much harm as good for those > > trying to apply it to languages with less draconian (or is it baroque) > > design. Although Ralph put in some Smalltalk references they were > > mostly in the way of commentary when they were trying to do similar > > things in C++. > > > > Patterns are all about picking paths due to the problem and situation > > at hand, and for better or worse, the programming language is a big > > part of the situation at hand. Most of the GOF book deals with the > > issues raised by statically typed oo languages, and aren't as portable > > as one might think. > > > I know I might be off a little bit, but I'd rather recommend a book of > a different friend of your's "Smalltalk Best Practices" by Kent Beck. > I know it is not about Design Patterns but Micro Patterns, I know it > is not about Ruby but about Smalltalk. > Anyway Kent calls Ruby Smalltalk in disguise for some reasons, I am of > course referring to the "Smalltalk beating Java and being called Ruby" > saying. > > Honestly I am only through the half of the book but there is just no > item so far I would not apply to Ruby. > > This book is a must read anyway, gotta read *all* of his books ;) I recently re-read this book, it's certainly a classic. I discussed it with Kent a few months back, and asked if he'd ever thought about doing a Ruby version, he said that he would like to but the book market just didn't pay enough to make it worthwhile. The real payoff in writing books for the technical market is the fame, and Kent is probably more than famous enough for his needs. On the other hand, I can't completely agree about it being 100% applicable to Ruby. As I've said before, programming patterns, best used, are selected in a world of tensions and pressures generated by the requirements and the languages and tools. If you look closely at Smalltalk Best Practice Patterns, many are specific to Smalltalk. Things like the patterns of how to construct Smalltalk objects don't really apply to Ruby. Patterns relating to instance state are affected by the differences between Smalltalk in which instance variables are declared in classes with slots allocated, and Ruby in which instance variables are dynamically acquired. Ruby instance variables are actually an example of the Variable State pattern which Kent, rightly, recommends using sparingly in Smalltalk. Many of Kent's patterns are related to interacting well with the Smalltalk IDE, i.e. doing things which work with the IDE to make it easier to read the code and find the code you need to read. And most of the chapter on Collection patterns isn't applicable directly to Ruby, although I would encourage Rubyists to get some background on Smalltalk collections. Maybe more on this in my blog. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/