Friday, March 04, 2005

Half-bean serendipity

I was struggling to explain to a fellow ex-ThoughtWorker this pattern I had half-formed in my head. The problem was how to construct an immutable when I didn't have all the constructor arguments handy. I was vaguely describing some kind of clever factory that scoops up arguments over time, and spits out an URI when you press the create() button using the constructor which most closely matches the information provided.

Then while looking at clever defense of REST I saw the reference to the half-bean pattern. Serendipity! That is exactly the description I was looking for. I was describing the Half-Bean pattern: the getters were all in the immutable URI, and the setters all in the factory with a factory method to tie them together.

Post a Comment