From: Robert Klemme Date: 2012-09-24T17:29:34+09:00 Subject: Re: sandwhich principle (ruby koans) On Mon, Sep 24, 2012 at 9:38 AM, Carlos Agarie 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/