Using same class names

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Using same class names

lanas
Hello all,

 Is there a way to have several classes with the same names and having
their scope limited to the current selected category ?  Eg.  I'd like to
experiment with the Abstract factory pattern and thus I would like to
make several tests, each in a category, like:

AL-AbstractFactory-1
AL-AbstractFactory-2

... and so on.  Each one is a variation and experiment. So I'd like to
keep the same class names but Squeak warns me that the CarPartFactory
I'm trying to create in AL-AbstractFactory-2 already exists in
AL-AbstractFactory-1.  Do I have to file the category out, remove it,
create a new test, file out that second test, remove it, then file in
the first test and such ?  

In other words, is there a way to quickly switch from one experiment
to the other when each of these experiments would use the same class
names and probably many of the same method names ?

By the way, in the System Browser, the row of buttons labeled browse,
senders, implementors, version, inheritance and such has
somehow disappeared.  Any new System Browser does not have that row of
buttons anymore.  Is there a way to bring them back short of reverting
to the original image.  This is Squeak 3.10.2.

Thanks for any suggestions,

Al
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Using same class names

Randal L. Schwartz
>>>>> "lanas" == lanas  <[hidden email]> writes:

lanas> In other words, is there a way to quickly switch from one experiment
lanas> to the other when each of these experiments would use the same class
lanas> names and probably many of the same method names ?

I think you'd need to use subclasses, and therefore your tests should
use parameterized class names.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Using same class names

lanas
Le Dimanche, 31 Janvier 2010 17:00:25 -0800,
[hidden email] (Randal L. Schwartz) a écrit :

> I think you'd need to use subclasses, and therefore your tests should
> use parameterized class names.

Would you care to give an example ? - Thanks.

Al

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Using same class names

K. K. Subramaniam
In reply to this post by lanas
On Monday 01 February 2010 06:09:35 am lanas wrote:
> Hello all,
>
>  Is there a way to have several classes with the same names and having
> their scope limited to the current selected category ?  Eg.  I'd like to
> experiment with the Abstract factory pattern and thus I would like to
> make several tests, each in a category, like:
AFAIK, classes are variables in global scope in Squeak. Try inspecting:
   #Integer
and
   Smalltalk at: #Integer

> In other words, is there a way to quickly switch from one experiment
> to the other when each of these experiments would use the same class
> names and probably many of the same method names ?
You may want to use facade class and subclass your variant classes from it.
E.g if you have classes Factory1, Factory2 etc. with the same methods, create
a facade superclass and invoke methods using current method. e.g.

  Factory current myownmethod

See senders and implementors of "current" method for examples.

> By the way, in the System Browser, the row of buttons labeled browse,
> senders, implementors, version, inheritance and such has
> somehow disappeared.  Any new System Browser does not have that row of
> buttons anymore.  Is there a way to bring them back short of reverting
> to the original image.  This is Squeak 3.10.2.
See optionalButtons in Preferences.

HTH .. Subbu
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Using same class names

Jerome Peace
In reply to this post by lanas
Hi lanas,

Hmmm. Hyphens wont work they will be interpreted as subtraction messages.
Underscores won't work in squeak either. They have historically been used as assignment characters. (Old story. In an ancient characterset they rendered as back arrows. Some oldtimes loved that and no ones gotten them to update. Pharo has made a point to ween themselves but not yet squeak.)

So ALAbstractFactoryA and ALAbstractFactoryB would be good names for experimental classes. Then copy the winning experiment to your main class name.

Do you mean for these abstract classes to have subclasses? That could have difficulties.

Yours in service and curiosity, --Jerome Peace

--- On Sun, 1/31/10, lanas <[hidden email]> wrote:

> From: lanas <[hidden email]>
> Subject: [Newbies] Using same class names
> To: [hidden email]
> Date: Sunday, January 31, 2010, 7:39 PM
> Hello all,
>
>  Is there a way to have several classes with the same names
> and having
> their scope limited to the current selected category
> ?  Eg.  I'd like to
> experiment with the Abstract factory pattern and thus I
> would like to
> make several tests, each in a category, like:
>
> AL-AbstractFactory-1
> AL-AbstractFactory-2
>
> ... and so on.  Each one is a variation and
> experiment. So I'd like to
> keep the same class names but Squeak warns me that the
> CarPartFactory
> I'm trying to create in AL-AbstractFactory-2 already exists
> in
> AL-AbstractFactory-1.  Do I have to file the category
> out, remove it,
> create a new test, file out that second test, remove it,
> then file in
> the first test and such ? 
>
> In other words, is there a way to quickly switch from one
> experiment
> to the other when each of these experiments would use the
> same class
> names and probably many of the same method names ?
>
> By the way, in the System Browser, the row of buttons
> labeled browse,
> senders, implementors, version, inheritance and such has
> somehow disappeared.  Any new System Browser does not
> have that row of
> buttons anymore.  Is there a way to bring them back
> short of reverting
> to the original image.  This is Squeak 3.10.2.
>
> Thanks for any suggestions,
>
> Al
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners