No, each flyweight instance is not a singleton.  It is a single instance of
a class, that's true.  However, there are also other instances of the same
class.  In the singleton design pattern, exactly one instance of the class
exists.  In the flyweight pattern, multiple instances of the class exist.
There are four AtomicSymbol instances created to represent each of the a, g,
c, and t DNA symbols.


----- Original Message -----
From: "Michael L. Heuer" <[EMAIL PROTECTED]>
To: "James Carman" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, April 25, 2002 12:21 PM
Subject: Re: [Biojava-l] Tutorial Suggestion...


>
> You're right -- it is an instantiation of the flyweight design pattern,
> where each flyweight instance is a singleton.
>
>    michael
>
> On Thu, 25 Apr 2002, James Carman wrote:
>
> > In the "Doesn't this all waste memory?" subsection of the "BioJava:
Symbols
> > and SymbolLists" section of the tutorial, you claim "there are just four
> > `singleton' Symbol objects which represent the symbols found in the DNA
> > alphabet."  This is not an example of the Singleton design pattern.  It
is
> > an example of the Flyweight (GoF) design pattern.  Doesn't the phrase
"four
> > singletons" sound a bit contradictory?  In any case, I do like the
design
> > and I was asking myself the same question immediately before I read that
> > section.
> >
> > James Carman, President
> > Carman Consulting, Inc.
> > 1218 Bobwhite Ct.
> > Edgewood, KY 41018
> > (513) 325-7977
> >
> >
> >
> > _______________________________________________
> > Biojava-l mailing list  -  [EMAIL PROTECTED]
> > http://biojava.org/mailman/listinfo/biojava-l
> >
>
>
>
>



_______________________________________________
Biojava-l mailing list  -  [EMAIL PROTECTED]
http://biojava.org/mailman/listinfo/biojava-l

Reply via email to