Java design question: Loosely coupled data extraction  
Author Message
Casper





PostPosted: 2007-3-10 11:33:00 Top

java-programmer, Java design question: Loosely coupled data extraction Ok, so I have a rather complex object hierarchy performing a bunch of
calculations and data manipulations. The hierarchy is populated using
the builder pattern, which worked nice for abstracting away database and
other data fetch mechanisms.
Now time has come to extracting some data from the hierarchy, a report
if you will. I would love to do this in the same loosely coupled way
rather than implementing tree walking logic directly into the nodes of
the hierarchy. My first though was the visitor pattern, as I guess it
would allow me to hook ANY reporting/extracting mechanism up. Does this
sound like a good idea? Are there alternatives you would suggest?

Thanks in advance,
Casper