On Fri, 27 Apr 2012 19:03:18 +0100, Rui Maciel wrote:
> If we have a data structure which we will need to output to a file and we
> don't know in advance which or how many file formats we will need to
> support, what's the best design pattern to implement the routines to dump
> the data to a file?
This is a classic full multiple dispatch case: Write/Read defined on two
independent type hierarchies: Medium and Persistent. A similar case is Draw
over Surface and Shape. Visitor pattern is usually suggested as a poor
man's solution when the language offers no multiple dispatch.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de