Searching a solution for double states for all objects

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

Searching a solution for double states for all objects

Frederic Pluquet-3
Hello,

I work on a tool in Squeak where all objects can be in two different states. A lot of methods depend on the object's state. For the moment, I check which type are the value of the variables of the current object (because the state is linked with the variables values) but it is very expensive in time.

A State pattern can be cool but adding an instance variable in the object is really not a good solution for me : all classes must be recompiled, taking time and some bugs appear...

A solution on the bit level : it must be done using a bit in each object ?

Can I do that ? And, if I can, how I can do that ?

Do you have some other ideas ?

Kind regards,

Fréd

--
Frédéric Pluquet
Université Libre de Bruxelles (ULB)
Assistant

Reply | Threaded
Open this post in threaded view
|

Re: Searching a solution for double states for all objects

Noury Bouraqadi
Hi Frederic,

What about duplicating your objects? Each time you instantiate a class, you create two objects that you keep (somhow) in sync...

Noury
Le 10 mars 07 à 12:53, Frederic Pluquet a écrit :

Hello,

I work on a tool in Squeak where all objects can be in two different states. A lot of methods depend on the object's state. For the moment, I check which type are the value of the variables of the current object (because the state is linked with the variables values) but it is very expensive in time.

A State pattern can be cool but adding an instance variable in the object is really not a good solution for me : all classes must be recompiled, taking time and some bugs appear...

A solution on the bit level : it must be done using a bit in each object ?

Can I do that ? And, if I can, how I can do that ?

Do you have some other ideas ?

Kind regards,

Fréd

--
Frédéric Pluquet
Université Libre de Bruxelles (ULB)
Assistant


Noury
------------------------------------------------------------------
Dr. Noury Bouraqadi - Enseignant/Chercheur
ARMINES - Ecole des Mines de Douai - Dept. I.A.

European Smalltalk Users Group Board
------------------------------------------------------------------