Ah yes, I see the distinction.

Very clever.

So how exactly should we update the documentation?? :)

   michael


On 25 Apr 2002, Phillip Lord wrote:

> >>>>> "James" == James Carman <[EMAIL PROTECTED]> writes:
>
>   James> No, each flyweight instance is not a singleton.  It is a
>   James> single instance of a class, that's true.  However, there are
>   James> also other instances of the same class.  In the singleton
>   James> design pattern, exactly one instance of the class exists.  In
>   James> the flyweight pattern, multiple instances of the class exist.
>   James> There are four AtomicSymbol instances created to represent
>   James> each of the a, g, c, and t DNA symbols.
>
> I think that the confusion comes from another related design pattern
> which is a common way of faking enums in Java. So...
>
>
> class Nucleotide{
>
>         private Nucleotide(){};
>
>         public static final Nucleotide a = new Nucleotide();
>         public static final Nucleotide c = new Nucleotide();
>         public static final Nucleotide g = new Nucleotide();
>         public static final Nucleotide t = new Nucleotide();
> }
>
> is not a singleton either, but clearly looks like it. It's not really
> a flyweight either, although it fulfils the same function where the
> number of instances are known and defined at compile time. Personally
> I consider it to be a singleton-ish method for nearly implementing a
> flyweight.
>
> See this is the problem with computer programming. Someone spends all
> this effort on synthesising only 23 patterns out of enormous
> complexity. And then someone at the back stands up and says "ah but
> what about....".
>
> A bit like biology really. There's always an exception to every rule.
>
>
> Phil
> _______________________________________________
> 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