On Mon, Sep 24, 2012 at 9:38 AM, Carlos Agarie <[email protected]> wrote: > Roelof, > > This principle says that when you have two pieces of code that are almost > identical, except for the "middle" part, you can create a method that takes > a block to fill the "middle" part.
Another pattern which has a similar structure and uses abstract methods and inheritance is "template method": http://en.wikipedia.org/wiki/Template_method_pattern Although with template method the stress is more on having different classes filling in portions of an algorithm with different functionality. On a higher level of abstraction both patterns share the property that part (or parts) of an algorithm are delegated to another method / function which is called from the basic algorithm implementation. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/ -- You received this message because you are subscribed to the Google Groups ruby-talk-google group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at https://groups.google.com/d/forum/ruby-talk-google?hl=en
