Hi all, my work of porting a piece of code is going on.. Now I have a bunch of classes of this sort:
FooObject (the original class) FooObjectSqueak (the class that contains the squeak implementation and that derives from FooObject)
Now I have a sort of design question. I have some examples and I want not to change them. So I want to be able to switch from one implementation to the other. How can I rewrite my classes so that I can call FooObject but really execute FooObjectSqueak code?
Ii think I will have a sort of wrapper class, but I don't know how to switch from one implementation to the other as cleanly as possible... any advice?
thanks a lot, nelson
Consider an Abstract Factory pattern. In a sentence - all creation of instances is done through calls to a singleton, which has different implementations. Each implementation generates classes from one of your alternatives.
If you prefer to use some Smalltalk trick (generating the class name (sometimes concatenating "Squeak") at runtime and doing lookup), use Factory Method to hide the trickery.
Daniel
nelson - wrote:
Hi all, my work of porting a piece of code is going on.. Now I have a bunch of classes of this sort:
FooObject (the original class) FooObjectSqueak (the class that contains the squeak implementation and that derives from FooObject)
Now I have a sort of design question. I have some examples and I want not to change them. So I want to be able to switch from one implementation to the other. How can I rewrite my classes so that I can call FooObject but really execute FooObjectSqueak code?
Ii think I will have a sort of wrapper class, but I don't know how to switch from one implementation to the other as cleanly as possible... any advice?
thanks a lot, nelson
squeak-dev@lists.squeakfoundation.org