[Goodie] OrderedSet and OrderedDictionary

Brian T Rice water at tunes.org
Thu Jun 12 17:59:26 UTC 2003


On Thu, 12 Jun 2003, Derek Brans wrote:

> Changes: all of Boris' tests work
> Removed extraneous methods and inspector methods from OrderedDictionary.
>
> Added some handy sequenceable collection accessing methods by just
> delegating to OrderedSet's 'order' instance variable.

You seem to delegate a lot to your instance variable 'order'. This seems
like a bad code smell, holding the elements (or keys for a Dict) in two
arrays at once, with one of them having another layer of protocol for
manipulation.

Why not just inherit from OrderedCollection and override the basic add-
methods (and at:put: and such) to test for the element's presence?

Otherwise there's not much point in making it ordered.

-- 
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/



More information about the Squeak-dev mailing list