Simberon Design Minute
 

Isolation by Closure

We've talked before about the need to isolate different parts of an object oriented application so that details in one part aren't known by another. I recently ran into an interesting case where the best way to provide isolation was to pass a block or closure. I needed to retrieve messages from one of many sources and perform operations on them. After the operation, though, I needed to perform an action specific to that one source. By passing a block, I was able to inject the operation back into the object that provided the message sources and it was able to take care of not only the looping needed but the post operation actions. For details on this example, see the post called "Two-sided Commit" on my blog simberon.blogspot.com.

Download