Possible code smell? - Abstract Collection members not overridden

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Possible code smell? - Abstract Collection members not overridden

Christoph Thiede

Hi all,


just a quick thought while working with some collections: There are a number of non-abstract Collection subclasses that do not override abstract members of Collection, such as #add: or #remove:ifAbsent::


Collection allSubclasses select: [:class |
(class lookupSelector: #add:) = (Collection >> #add:)].
Collection allSubclasses select: [:class |
(class lookupSelector: #remove:ifAbsent:) = (Collection >> #remove:ifAbsent:)].

I.e. for example, RunArray new add: 1 raises a SubclassResponsibility rather than a NotImplemented (#shouldNotImplement) exception. Do you think this is a code smell/erroneous behavior and should be fixed? Or should we just use #shouldNotImplement in Collection >> #add: & Co.?

We might have similar effects in other hierarchies, but I did not check my entire image for them ...


Best,

Christoph



Carpe Squeak!