On Tue, 2003-06-10 at 19:25, Hainer, Neil wrote: > I know I will have to do the same thing for another vendor's document > extraction product. That product will have its own unique results > object and have unique method names. > > So.... > > How can I design my code so I can re-use the RDF code with different > vendor's results objects?
You can use "Template Method" GOF pattern. Your AbstractClass (RDF_writer) will implement TemplateMethod (write_to_file) and declare some primitive (data extraction) operations. Each ConcreteClass (Result1_RDF_writer, Result2_RDF_writer) will override data extraction methods to obtain desired information from concrete data source object (Result1, Result2). So you will have the algorithm of formatting incapsulated to RDF_writer and concrete ResultX_RDF_writers which will know all about specific ResultX interface. -- Andrew Chelyabin <[EMAIL PROTECTED]> _______________________________________________ gang-of-4-patterns mailing list [EMAIL PROTECTED] http://mail.cs.uiuc.edu/mailman/listinfo/gang-of-4-patterns
