Skip to Content.
Sympa Menu

gang-of-4-patterns - Re: [gang-of-4-patterns] Advice Sought Regarding Proper Design

gang-of-4-patterns AT lists.cs.illinois.edu

Subject: Design Patterns discussion

List archive

Re: [gang-of-4-patterns] Advice Sought Regarding Proper Design


Chronological Thread 
  • From: Andrew Chelyabin <chelyabin AT sctest.vrn.ru>
  • To: gang-of-4-patterns AT cs.uiuc.edu
  • Subject: Re: [gang-of-4-patterns] Advice Sought Regarding Proper Design
  • Date: 11 Jun 2003 14:11:11 +0400
  • List-archive: <http://mail.cs.uiuc.edu/pipermail/gang-of-4-patterns/>
  • List-id: Design Patterns discussion <gang-of-4-patterns.cs.uiuc.edu>
  • Organization:

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
<chelyabin AT tspotest.comch.ru>





Archive powered by MHonArc 2.6.16.

Top of Page