[Pharo-project] Smells looking at collections

Nicolás Paez nicopaez at gmail.com
Fri Oct 22 07:56:28 EDT 2010


Hi, I was looking at collection packages and I found that the class
Association inherits from Magnitude.
It is really strange for me because inheritance represent a "is-a" relation.

So I looked that the documentation of each of these classes:

*Association:* I represent a pair of associated objects--a key and a value.
My instances can serve as entries in a dictionary.

*Magnitude:* I'm the abstract class Magnitude that provides common protocol
for objects that have
the ability to be compared along a linear dimension, such as dates or times.
Subclasses of Magnitude include Date, ArithmeticValue, and Time, as well as
Character and LookupKey.

Based on this, I think this relation is conceptually WRONG.
If the idea is to reuse code then composition should be used instead of
inheritance.

What do you think?

Saludos!
Nico.
blog: nicopaez.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20101022/1c005f54/attachment-0001.html>


More information about the Pharo-dev mailing list