2006/5/18, uncutstone wu <uncutstone / sina.com>:
> Ruby is highly dynamic and extensible. Ruby is duck typed. Interface
> which is pervasive in Java is hard to see in Ruby. Thing changes. Many
> Gangof4 design patterns handle limitations of static languages like java
> and C++. So I think in Ruby, some design patterns become trivial or
> irrelevent , some can be simplified a lot.
> Ruby is a fully object-oriented language. If we talk about OO, we surely
> concerns about design patterns.I think many of us want to see what
> happens to design patterns in ruby.

That might be an interesting thing to do.

> And I think the best way is to check the G4 design patterns one by one
> to see which one can be simplified , which one becomes trivial , or some
> new ones can be introduced.
> Actually, I just think it is a good idea and I am not qualified to do
> that. But I think this community can do it. Anyone checks a pattern,
> then post his result here. We will soon get a revised version of design
> patterns in ruby.  It's attractive. I hope you are instrested , your
> attendance is highly appeciated.
>
> And I will post one first, an abstract factory example, which can be
> simplified a lot as following. You can see, no inheritance tree needed.

<snip/>

IMHO you don't even need a separate class.  Every object that
implements #new is a factory, especially every class object is.  So
storing an object somewhere and requiring that it implements new
without args is enough.

Regards

robert


-- 
Have a look: http://www.flickr.com/photos/fussel-foto/