Tuesday, November 3, 2009

Visitor pattern

I am currently working in porting GCC to a VLIW architeture. Last week our tool's team director met each one of us in the GCC port team. I observed a behavioral pattern involved. I could imagine our director as a visitor who wants visit the entire team. He had to convey message to each one of us. The algorithm (message) for each one of us (elements) is different.

So our director started by asking the root node (Project manager) to accept his visit. He replied by visiting him. The project manager in-turn passed director message about visiting (accept) to the child nodes (each team member) in some order. Every member accepted his request and met him (double dispatch)one by one.


To know about visitor pattern http://en.wikipedia.org/wiki/Visitor_pattern

2 comments: