Hello
The TheWorldMainDockingBar is implemented as a Singleton. To access the sole instance the method #instance is used. But we have 35 implementor of #default and 20 implementors of #current for implementing Singletons. Could somebody please change this the next time? And TheWorldMainDockingBar is hard coded 5 places One thing we could do is to add the method mainDockingBarClass ^TheWorldMainDockingBar to MorphicProject and then replace the hard coded TheWorldMainDockingBar with MorphicProject current mainDockingBarClass This is still hard coded but now offers the option that if I subclass MorphicProject I can have another menu there. What do you think? Hannes |
On 11/6/10, Hannes Hirzel <[hidden email]> wrote:
> Hello > > The TheWorldMainDockingBar is implemented as a Singleton. .... > This is still hard coded but now offers the option that if I subclass > MorphicProject I can have another menu there. > OK, to make this work we have to move the class variable which holds the single object to a class instance variable HJH |
In reply to this post by Hannes Hirzel
On Sat, 6 Nov 2010, Hannes Hirzel wrote:
> Hello > > The TheWorldMainDockingBar is implemented as a Singleton. > > To access the sole instance the method #instance is used. But we have > 35 implementor of #default and 20 implementors of #current for > implementing Singletons. There's also #soleInstance and probably a few more. Some people like this, others like that. Also some singletons are implemented with a class variable, others use class instance variables. > > Could somebody please change this the next time? You? :) Levente > > And TheWorldMainDockingBar is hard coded 5 places > > One thing we could do is to add the method > > mainDockingBarClass > ^TheWorldMainDockingBar > > to MorphicProject > > and then replace the hard coded > > TheWorldMainDockingBar > > with > > MorphicProject current mainDockingBarClass > > > This is still hard coded but now offers the option that if I subclass > MorphicProject I can have another menu there. > > What do you think? > > Hannes > > |
On 11/6/10, Levente Uzonyi <[hidden email]> wrote:
> On Sat, 6 Nov 2010, Hannes Hirzel wrote: > >> Hello >> >> The TheWorldMainDockingBar is implemented as a Singleton. >> >> To access the sole instance the method #instance is used. But we have >> 35 implementor of #default and 20 implementors of #current for >> implementing Singletons. > > There's also #soleInstance and probably a few more. Some people like this, > others like that. > Also some singletons are implemented with a class variable, others use > class instance variables. > >> >> Could somebody please change this the next time? > > You? :) Thank you for the feedback. I just tried to put the changed package Morphic into the inbox; but it gives me a timeout with the current connection (GPRS/EDGE). So what I did a) added a class instance variable 'Default' b) changed the the method #instance to #default and updated it accordingly (in addition instead of 'super new' just 'self new') c) replaced the call to #instance with #default d) removed method #instance e) removed class variable Instance --Hannes > > Levente > >> >> And TheWorldMainDockingBar is hard coded 5 places >> >> One thing we could do is to add the method >> >> mainDockingBarClass >> ^TheWorldMainDockingBar >> >> to MorphicProject >> >> and then replace the hard coded >> >> TheWorldMainDockingBar >> >> with >> >> MorphicProject current mainDockingBarClass >> >> >> This is still hard coded but now offers the option that if I subclass >> MorphicProject I can have another menu there. >> >> What do you think? >> >> Hannes >> >> > > |
In reply to this post by Hannes Hirzel
Should the docking bar be associated with MorphicProject or a PasteUpMorph?
On Sat, Nov 6, 2010 at 12:48 AM, Hannes Hirzel <[hidden email]> wrote: > Hello > > The TheWorldMainDockingBar is implemented as a Singleton. > > To access the sole instance the method #instance is used. But we have > 35 implementor of #default and 20 implementors of #current for > implementing Singletons. > > Could somebody please change this the next time? > > And TheWorldMainDockingBar is hard coded 5 places > > One thing we could do is to add the method > > mainDockingBarClass > ^TheWorldMainDockingBar > > to MorphicProject > > and then replace the hard coded > > TheWorldMainDockingBar > > with > > MorphicProject current mainDockingBarClass > > > This is still hard coded but now offers the option that if I subclass > MorphicProject I can have another menu there. > > What do you think? > > Hannes > > |
In reply to this post by Hannes Hirzel
FYI, I believe class-inst vars should begin with lower-case by convention.
As far as the singleton's mess, what does anyone think of abstract Singleton class with a 'default' (or 'current', 'soleInstance' it doesn't matter, we'll just pick one) class-inst var? And with appropriate access, of course. That way we could have one place where most singletons inherit from. I say most because some might need to inherit behavior from another class; oh well, hopefully they'll make it consistent with whatever would be decided for Singleton. At least something would exist to be consistent with.. On Sat, Nov 6, 2010 at 2:00 AM, Hannes Hirzel <[hidden email]> wrote: > On 11/6/10, Levente Uzonyi <[hidden email]> wrote: >> On Sat, 6 Nov 2010, Hannes Hirzel wrote: >> >>> Hello >>> >>> The TheWorldMainDockingBar is implemented as a Singleton. >>> >>> To access the sole instance the method #instance is used. But we have >>> 35 implementor of #default and 20 implementors of #current for >>> implementing Singletons. >> >> There's also #soleInstance and probably a few more. Some people like this, >> others like that. >> Also some singletons are implemented with a class variable, others use >> class instance variables. >> >>> >>> Could somebody please change this the next time? >> >> You? :) > > Thank you for the feedback. > > I just tried to put the changed package Morphic into the inbox; but it > gives me a timeout with the current connection (GPRS/EDGE). > > So what I did > > a) added a class instance variable 'Default' > b) changed the the method #instance to #default and updated it > accordingly (in addition instead of 'super new' just 'self new') > c) replaced the call to #instance with #default > d) removed method #instance > e) removed class variable Instance > > > --Hannes > >> >> Levente >> >>> >>> And TheWorldMainDockingBar is hard coded 5 places >>> >>> One thing we could do is to add the method >>> >>> mainDockingBarClass >>> ^TheWorldMainDockingBar >>> >>> to MorphicProject >>> >>> and then replace the hard coded >>> >>> TheWorldMainDockingBar >>> >>> with >>> >>> MorphicProject current mainDockingBarClass >>> >>> >>> This is still hard coded but now offers the option that if I subclass >>> MorphicProject I can have another menu there. >>> >>> What do you think? >>> >>> Hannes >>> >>> >> >> > > |
In reply to this post by Chris Muller-3
The first answer which comes to mind is to associate it with
MorphicProject. So each project can have a particular menu. If we associate it with PasteUpMorph we might have a docking bar menu within SystemWindows. Normally we put a PasteUpMorph into a system window. For a first iteration though I think MorphicProject is fine. On 11/7/10, Chris Muller <[hidden email]> wrote: > Should the docking bar be associated with MorphicProject or a PasteUpMorph? > > On Sat, Nov 6, 2010 at 12:48 AM, Hannes Hirzel <[hidden email]> > wrote: >> Hello >> >> The TheWorldMainDockingBar is implemented as a Singleton. >> >> To access the sole instance the method #instance is used. But we have >> 35 implementor of #default and 20 implementors of #current for >> implementing Singletons. >> >> Could somebody please change this the next time? >> >> And TheWorldMainDockingBar is hard coded 5 places >> >> One thing we could do is to add the method >> >> mainDockingBarClass >> ^TheWorldMainDockingBar >> >> to MorphicProject >> >> and then replace the hard coded >> >> TheWorldMainDockingBar >> >> with >> >> MorphicProject current mainDockingBarClass >> >> >> This is still hard coded but now offers the option that if I subclass >> MorphicProject I can have another menu there. >> >> What do you think? >> >> Hannes >> >> > > |
In reply to this post by Chris Muller-3
Yes, that is a more general goal. I am happy I somebody takes this one.
At this very moment I for myself just would like everybody to agree that we can move TheWorldMainDockingBar instance to TheWorldMainDockingBar instance Is this OK? On 11/7/10, Chris Muller <[hidden email]> wrote: > FYI, I believe class-inst vars should begin with lower-case by convention. > > As far as the singleton's mess, what does anyone think of abstract > Singleton class with a 'default' (or 'current', 'soleInstance' it > doesn't matter, we'll just pick one) class-inst var? And with > appropriate access, of course. > > That way we could have one place where most singletons inherit from. > I say most because some might need to inherit behavior from another > class; oh well, hopefully they'll make it consistent with whatever > would be decided for Singleton. At least something would exist to be > consistent with.. > > > > On Sat, Nov 6, 2010 at 2:00 AM, Hannes Hirzel <[hidden email]> > wrote: >> On 11/6/10, Levente Uzonyi <[hidden email]> wrote: >>> On Sat, 6 Nov 2010, Hannes Hirzel wrote: >>> >>>> Hello >>>> >>>> The TheWorldMainDockingBar is implemented as a Singleton. >>>> >>>> To access the sole instance the method #instance is used. But we have >>>> 35 implementor of #default and 20 implementors of #current for >>>> implementing Singletons. >>> >>> There's also #soleInstance and probably a few more. Some people like >>> this, >>> others like that. >>> Also some singletons are implemented with a class variable, others use >>> class instance variables. >>> >>>> >>>> Could somebody please change this the next time? >>> >>> You? :) >> >> Thank you for the feedback. >> >> I just tried to put the changed package Morphic into the inbox; but it >> gives me a timeout with the current connection (GPRS/EDGE). >> >> So what I did >> >> a) added a class instance variable 'Default' >> b) changed the the method #instance to #default and updated it >> accordingly (in addition instead of 'super new' just 'self new') >> c) replaced the call to #instance with #default >> d) removed method #instance >> e) removed class variable Instance >> >> >> --Hannes >> >>> >>> Levente >>> >>>> >>>> And TheWorldMainDockingBar is hard coded 5 places >>>> >>>> One thing we could do is to add the method >>>> >>>> mainDockingBarClass >>>> ^TheWorldMainDockingBar >>>> >>>> to MorphicProject >>>> >>>> and then replace the hard coded >>>> >>>> TheWorldMainDockingBar >>>> >>>> with >>>> >>>> MorphicProject current mainDockingBarClass >>>> >>>> >>>> This is still hard coded but now offers the option that if I subclass >>>> MorphicProject I can have another menu there. >>>> >>>> What do you think? >>>> >>>> Hannes >>>> >>>> >>> >>> >> >> > > |
Am 2010-11-08 um 15:53 schrieb Hannes Hirzel:
> move > > TheWorldMainDockingBar instance > > to > > TheWorldMainDockingBar instance Cant move instance: same file ;) SCNR So Long, -Tobias |
Sorry I wanted to write
> TheWorldMainDockingBar instance > > to > > TheWorldMainDockingBar default And at the same time move the class variable which holds the singleton to a class instance variable so that we can subclass TheWorldMainDockingBar . Is this possible to do this so that Monticello catches everything properly? 1) create a class instance variable -- default 2) create the access method on the class side #default default "Answer the receiver's instance" ^ default ifNil: [default := self new] "in the original method it was 'super new'" 4) replace calls to TheWorldMainDockingBar instance with TheWorldMainDockingBar default 5) run 'rebuild menus' (menu label) TheWorldMainDockingBar updateInstances "(message)" 6) remove the method #instance 7) remove the class variable 'Instance' N.B. In the other thread 'TheWorldMainDockingBar' we are discussing how to remove the hard coded reference TheWorldMainDockingBar default The question is if it is OK to have something like MorphicProject class>>defaultWorldMenuMainDockingBar On 11/8/10, Tobias Pape <[hidden email]> wrote: > Am 2010-11-08 um 15:53 schrieb Hannes Hirzel: >> move >> >> TheWorldMainDockingBar instance >> >> to >> >> TheWorldMainDockingBar instance > > Cant move instance: same file > > > ;) > SCNR > > So Long, > -Tobias > > |
Administrator
|
Hannes,
Thanks for taking care of this and making the system better. Every simplification matters, and it seems obvious to just choose a convention e.g. "default" and stick with it. Sean
Cheers,
Sean |
Administrator
|
In reply to this post by Hannes Hirzel
Hannes,
Thanks for taking care of this and making the system better. Every simplification matters, and it seems obvious to just choose a convention e.g. "default" and stick with it. Sean
Cheers,
Sean |
Free forum by Nabble | Edit this page |