On Jul 26, 8:01 am, Tom Anderson <t...@urchin.earth.li> wrote:
But Joshua was talking about using instances of Color, where those
instances are singletons (well, flyweights is probably the right term
when there are several of them), exposed in static final fields on
Color, and
While I agree with Tom's main point here,I am dubious about his
suggestion for what the static instances should be called in a class
that only creates a unique closed set of such instances.
I don't think flyweights is the right word. For me flyweights are
classes where part of the state is externalized for some purpose. This
is orthogonal to the concept of singletons. E.g., suppose I were running
a simulation of galaxy mergers of two 100-million-star galaxies. Stars
differ only in position, velocity and mass. Rather than creating 200
million Star objects I might create a combination flyweight/singleton
Star where each method call includes an index that is used to find the
mutable state in a few external arrays.
derives. If you want to use a different definition, then that's fine, but
Multipleton.
More seriously, enumeration.