Skip to Content.
Sympa Menu

gang-of-4-patterns - [gang-of-4-patterns] strategy, state , template ????

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

Subject: Design Patterns discussion

List archive

[gang-of-4-patterns] strategy, state , template ????


Chronological Thread 
  • From: Bharathi Thiyagarajan <bharathi.thiyagarajan AT adcc.alcatel.be>
  • From: Thiyagarajan_BHARATHI/IN/ALCATEL@ALCATEL
  • To: gag-of-4-patterns <gang-of-4-patterns AT cs.uiuc.edu>
  • Subject: [gang-of-4-patterns] strategy, state , template ????
  • Date: Fri, 19 Dec 2003 10:38:09 +0530
  • 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: Alcatel Development Center Chennai

Hello *

I think I will give a glimpse of scenario of my problem so that
we can discuss and conclude which will be the best design pattern

Here is the scenario:
I have 3 types of trace files (A , B, C) each has
its own format and requires a different way of parsing the file to pick
data from the file.
so Afile has a Aparser, Bfile has Bparser, and
Cfile has Cparser. apart from these Aparser, Bparser, Cparser there are
common methods
that can be reused for parsing the file.

Now the design for this:

Trace <>--------> TraceParser

/ | \ (sorry the lines
here indicate inheritance/generalization)

AparserType BparserType CparserType

Points for discussion:
1. If TraceParse has a method ParserTrace which
AparseType , BparseType , CparserType has different implementation for
it --- It is Strategy
2. If TraceParser has many methods some of them are
common for the three parser types and some of then have been overridden
by the three parser Types -
is it a template method ????
3. The input file at a point can be one of TraceType,
Trace will decided by checking the file which TraceType is it and based
on that object AparserType/
BparserType/CparserType is created

Please enlighten me , correct me so that I will learn from my
mistakes.

Thanks & Regards
Bharathi










Archive powered by MHonArc 2.6.16.

Top of Page