[squeak-dev] Subclassing OrderedCollection in an external package

Bert Freudenberg bert at freudenbergs.de
Tue Mar 5 23:02:37 UTC 2013


On 2013-03-05, at 23:33, tim Rowledge <tim at rowledge.org> wrote:

> On 05-03-2013, at 2:22 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
> 
>> On 2013-03-05, at 23:06, tim Rowledge <tim at rowledge.org> wrote:
>> 
>>> On 05-03-2013, at 2:01 PM, Chris Muller <asqueaker at gmail.com> wrote:
>>> 
>>>>> P.S.: If XMLOrderedList is a subclass of OrderedCollection, then it's just
>>>>> plain wrong IMHO. Creating subclasses of collections in external packages is
>>>>> bad practice.
>>>> 
>>>> Hi Levente, I was just curious why that is bad practice.
>>> 
>>> I am also curious why you think that. Making subclasses is pretty much the essence of programming.
>> 
>> I'm curious why you would feel the need to subclass OrderedCollection, have to agree with Levente.
>> 
>> It's bad practice to subclass for no good reason,
> 
> It's bad practice to do *anything* for no good reason. Given a good reason, do it.
> 
> 
>> because you're much more likely to depend on the implementation details of your superclass, and not just its external interface. One shortcoming of Smalltalk in particular is that all the implementation details are visible, so they tend to get made use of. Which is perfectly fine for a personal computing system in one image, but not for a collaboratively maintained one, where we have to worry about breaking subclasses that are not in the image.
> 
> If we had actual external interfaces, and if anyone ever paid attention, and if I even occasionally came across really well-written code…. but we don't and hardly anyone does and it never - well hardly ever(©Gilbert & Sullivan)  - happens. But I'd rather have a package with code that can be improved than no package at all.

Agreed. Still, for noobs who get too excited about their discovery of subclassing, it is worth mentioning that it's not always a good idea.

- Bert -




More information about the Squeak-dev mailing list