SBPP #3: Reversing Method

I’m pleased to find Kent Beck shares my affinity for methods with a consistent cadence. In the next pattern I translate, he looks for a way to bring a uniform rhythm to a method that writes an object to a stream.

[gist id=”1236930″]

2 comments

  1. Two comments: 
    1. The label “cadence” is something I’ve been looking for.  I have notions of symmetry and “balance” which I can’t really explain, but I know how I feel when dealing with code lacking either. A well-balanced code base which applies symmetry wherever possible will likely have a pleasing cadence. As I understand these terms.

    1. I like this example a lot, so I’ve already copied it and started playing around with it.  That print_on(io) is very nice.

Leave a Reply

Your email address will not be published. Required fields are marked *