Still trying to kill that pesky morph......

John Hinsley jhinsley at telinco.co.uk
Mon Oct 22 15:29:44 UTC 2001


Andreas Raab wrote:
> 
> John,
> 
> > Well, I can only speak as regards what happens (I'm not up to speed on
> > theory and am always ready to be corrected!):
> 
> If you look at the code then you see that #initializeLocally creates the WTM
> (in the variable morph) but does not return it. So if you add as the very
> last line
> 
>         ^morph
> 
> then you will be able to get your hands on the morph that was created (and
> later on say 'delete' to it). [BTW, since the method has no explicit return,
> an implicit 'return self' will be added at the end - but 'self' in this case
> is WorldTimeMorph's CLASS and not the morph that was created]

Ah. I'd tried ^self, of course. Hadn't thought of ^morph.

> 
> One more side note: The method 'initialize' on the class side is intended to
> perform specific class initialization - what's in there right now
> (attempting to connect to a remote location and opening a new WTM) should
> certainly _not_ go there. Just consider somebody who is not online - that
> person will get errors when trying to file in the class. I'd recommend
> renaming these two methods into 'open' and 'openLocally' respectively.

This explains another mystery to me: thanks!

> 
> > Turning Ned's code into a method "kill" deletes it.
> 
> Yes, surely. But it's like taking a nuke to get rid of a single ant. Delete
> this kill method - it is extremely bad style, a last-resort solution for
> cases that you don't even want to think about.
> 
> [BTW, I find it generally a bad idea to teach people these 'last resort'
> solutions in a context where they are clearly not needed. This leads people
> to think that this is the way to do it when you really should learn
> something entirely different (like to look for a return statement or insert
> one)]

Well, in my case I was almost prepared to nuke it! (And Ned was probably
ready to nuke me....;-) 
I'm happy to learn both nuclear and precision coding techniques from
anyone and everyone and virtually everything I've learnt from Ned has
been of the precision variety. And then, I've just been through a course
which implicitly demanded -- for one question -- that students utterly
ignore what John Maloney might call the "new" paradigm and write one
truly horrible method. (You'd have been marked down for doing it
correctly -- that is, respecting the paradigm.) The answer to my
question: "Why are they teaching people to code like this?" was not
returned!

My own learning style tends to be desire ("How can I make this?") led.

In so far as this impinges (and, I guess, implicitly it does) on the
dreaded Rolodex Tutorial, well, it is very much Gonzo programming on my
part. A newbies tutorial by a newbie. When it gets where it's going,
I'll tidy it up so that it will reflect good style, rather than being a
rough sketch. And I'll be able to show the tidying. That way we'll all
be able, newbies and überhackers alike, to giggle at (and maybe learn
from) my clumsiness.

Thanks again

Cheers

John 


-- 
If you don't care about your data, like file systems which automagically
destroy themselves and have money to burn on 3rd party tools to keep
your
system staggering on, Microsoft (tm) have the Operating System for you.




More information about the Squeak-dev mailing list