[squeak-dev] SystemWindow #knownName violates principle of least astonishment

John-Reed Maffeo jrmaffeo at gmail.com
Wed Dec 13 02:00:38 UTC 2017


Tobias,

The application I am building uses #SystemWindow. The window has a model
which contains the application program logic. One of the methods in my
model wants to access the #SystemWindow so I gave it a name. When I tried
to access the system window by name I got the label of the window and not
the name  I gave it (I was astonished!). As I dug through the code, I saw
that the #knownName methods in #Morph and #SystemWindow return different
values.

Note: I am still a newbie andMorphic has been a mystery to me for a long
time .

I can work around the issue, but I was surprised, and confused by the fact
that I was not getting the result I expected when I tried to access my
application system window by the  name I had given it. My design is
probably bollocks and I don't really need to access the system window from
the model, but I thought it was something deserved review.

http://wiki.c2.com/?PrincipleOfLeastAstonishment

Thanks for taking and interest,

-jrm



On Tue, Dec 12, 2017 at 5:51 PM, Tobias Pape <Das.Linux at gmx.de> wrote:

>
> "SystemWindow #knownName violates principle of least astonishment"
>
> Care to explain?
>
> Best regards
>         -Tobias
>
> > On 12.12.2017, at 22:33, John-Reed Maffeo <jrmaffeo at gmail.com> wrote:
> >
> > SystemWindow
> > knownName
> >
> > ^label
> >
> > ___________
> >
> > Morphic
> > knownName
> >       "answer a name by which the receiver is known, or nil if none"
> >       ^ extension ifNotNil: [extension externalName]
> >
> > _____________
> >
> > I modified and tested the attached.
> >
> > -jrm
> > <SystemWindow-knownName.st>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20171212/94a4ce92/attachment.html>


More information about the Squeak-dev mailing list