gang-of-4-patterns AT lists.siebelschool.illinois.edu
Subject: Design Patterns discussion
List archive
- 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>
- [gang-of-4-patterns] Advice Sought Regarding Proper Design, Hainer, Neil, 06/10/2003
- Re: [gang-of-4-patterns] Advice Sought Regarding Proper Design, Andrew Chelyabin, 06/11/2003
- <Possible follow-up(s)>
- RE: [gang-of-4-patterns] Advice Sought Regarding Proper Design, Ray Ye, 06/10/2003
Archive powered by MHonArc 2.6.16.