openAsMorph refactoring (was Re: TestRunner Ui in 3.1)

Doug Way dway at riskmetrics.com
Thu Sep 20 17:44:52 UTC 2001


Bijan Parsia wrote:
> 
> On Wed, 19 Sep 2001, Robert Hirschfeld wrote:
> 
> > Stephane,
> >
> > In Morphic, evaluate 'TestModel openAsMorph'.
> > In an MVC project, try 'TestModel open'.
> 
> Ooo, ok, this brings up an issue for me...
> 
> ...can we unify #openAsMorph and #open in a coherent systematic way?
> 
> I know a lot of apps, ad hocly do do:
> 
>         Smalltalk isMorphic ifTrue: [^ self openAsMorph].
> 
> and then MVC stuff. But surely this can be done onceAndOnlyOnce?

I think so.  It seems like a few methods could be added in Model to handle opening and the isMorphic test, and get rid of all the isMorphic tests in the subclasses.

It seems like 'MyModel open' might be a good standard way for any model class to create and open an instance of itself as a view or a morph, depending on whether one is in a MVC or Morphic project.  The existing MVC-based #open methods could be renamed to #openInView or #openAsView or somesuch.

Maybe there could also be an instance-side Model>>open method, which then does the isMorphic test and calls either openAsMorph or openInView.  (Model class>>open would just be "self new open".)  Or, maybe it should all stay on the class side.  Hmm, looking at the implementors of #openAsMorph and #open, I see they're mixtures of instance-side and class-side... more cleanup to do.  Any thoughts on this?

> And it would be way more extensible (hey, we might add yet another project
> type!)
> 
> Thoughts, feelings? I hereby volunteer to help with the cleanup.

Sounds good.  I hereby volunteer Bijan to be in charge of the cleanup. ;)  (I could probably help out.)

> Or should this just be replaced with the stable squeak XML UI stuff?

It's hard to say when or if that would happen, and there's certainly no harm in refactoring/improving what we currently have, so I think we should go ahead and clean it up.

- Doug Way
  dway at riskmetrics.com




More information about the Squeak-dev mailing list