[Pharo-project] SmallDictionary ?? vs RB SmallDictionary

Lukas Renggli renggli at gmail.com
Tue Jan 13 04:56:06 EST 2009


> We have no idea where SmallDictionary come from? It was not in 3.9
> Especially since

The original SmallDictionary comes from RB. I once read some
justification why this is useful for RB, but I do not remember where I
found that.

> and it does not seems defined as needed.
> RBSmallDictionary seems much better.

They both have the problem that they subclass from Dictionary and you
inherit a lot of stuff that is not really necessary. As far as I know
the original RBSmallDictionary was not a subclass of Collection.

> We are currently applying traits tests to these classes and this is
> really interesting to see the bugs popping out.

Seaside has WASmallDictionary, another reincarnation of the RBSmallDictionary.

We need it because we have lots of small dictionaries that we want to
access fast. Furthermore the WASmallDictionary is ordered, so it
remembers the order in which keys are added. This makes everything
that seaside produces deterministic and therefore much easier to test
(before sometimes attributes appeared in a different order in the
generated html). Also WASmallDictionary makes it easy to have
subclasses where the same key is defined multiple times (as for
example necessary for request and response header fields).

Of course we also wrote a lot of tests. Maybe you want to have a look at those?

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch




More information about the Pharo-dev mailing list