[squeak-dev] Coding style (was: Future of Squeak, and outsider's view)

Michael van der Gulik mikevdg at gmail.com
Tue Jun 30 05:09:52 UTC 2009


On Tue, Jun 30, 2009 at 4:53 PM, Cameron Sanders <
csanders.personal at functional-analyst.com> wrote:

>
> On Jun 30, 2009, at 12:22 AM, Michael van der Gulik wrote:
>
>  Back to the question of adding behavior to classes that you don't own.
>> VisualWorks has a means to extend a class in a different package ... as I
>> recall. As I recall, squeak has no such capability, right?
>>
>>
>> Squeak certainly has that capability, but I would discourage you from
>> using it.
>>
>
> Why?



It's a gut feeling thing rather than any serious good coding practise.

Often if you feel the need to put code for your package in another package,
then that other package was somehow deficient and your modifications should
be made to that other package "properly".

If your package modified another package such that it gains knowledge of
other class's internal behaviour, you're breaking encapsulation and leaving
your code prone to breakage when that other package changes.

Collisions can occur if two packages try to modify the same method on a
third package.

It spreads your code around. I like to keep my code in one place and I've
personally got a tendency to write slightly less elegant code which is
"right here" in preference to modifying external classes.

Gulik.

-- 
http://gulik.pbwiki.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090630/81bc77bf/attachment.htm


More information about the Squeak-dev mailing list