[Cuis-dev] Interesting thoughts about Color
Phil B
pbpublist at gmail.com
Sun Apr 28 17:57:11 PDT 2019
Ken,
I'm not following your thinking here. What other implementations of
things like #darker are you thinking of and how would renaming break
encapsulation?
As an example, let's say we had Form implement #darker which darkened the
image and Color where #darker returns a new, darker color. I'd see that as
semantic overloading, not polymorphism. And in the event we actually
wanted the Form implementation to return a new, darkened Form, how would
calling it #asDarkerForm break encapsulation? To me, that's just making it
clear that you are not darkening the existing image but rather creating a
new one... I still have no idea what's going on inside the object, only
what I expect it to do/return.
Thanks,
Phil
On Sun, Apr 28, 2019 at 8:37 PM ken.dickey--- via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:
> On 2019-04-28 16:45, Phil B via Cuis-dev wrote:
>
> > That was pretty much the point being made: rename the methods so it's
> > clear that they are returning a new color rather than modifying the
> > current one. (i.e. the issue is the naming, not the underlying
> > implementation)
>
> The point here is implementation hiding.
>
> I want names to be polymorphic. If method names to care about
> mutable/immutable or immediate/vector/composite I lose polymorphism.
>
> I know how the implementation works. I would like to be able to change
> the implementation and have most code still work.
>
> The classic example is changing character support from ASCII to Unicode.
> (e.g. see package
> https://github.com/Cuis-Smalltalk/EnhancedText/tree/master/Unicode).
> There is a whole bunch of implementation magic, but using the text
> editor pretty much just works.
>
> Changing selectors because they had to indicate how things were
> implemented would have broken encapsulation and causes a huge amount of
> work.
>
> Breaking encapsulation would be very un-Smalltalk!
>
> $0.02,
> -KenD
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20190428/b475e966/attachment-0001.html>
More information about the Cuis-dev
mailing list