[Tutor] Re: Factory classes (etc)

Arthur ajs@ix.netcom.com
Wed, 4 Sep 2002 09:19:12 -0400


Magnus writes -

>I guess the problem is that the Factory patterns aren't based on any
>real world problem, but on a pure consequence of how object oriented
>programming languages are typically implemented: You typically get hold
>of an object by invoking a constructor method in a class object. If you
>want to be able to get instances of different classes depending on
>context, this won't work.

Quite glad the discussion came up.

Rightly or wrongly, I am convinced that the standard Python approaches to
class constructors don't quite work in my situation and I need to
go further.

But it seems I can leave my 40 odd classes intact, and create
"consolidating"
Factory classes with which the user interacts, and which will
(hopefully, eventually) create the appropriate instances based on argument
signature.

Whereas Factory classes do not directly solve my problem, which I am
calling a mothod overloading issue, I think it does point to a significantly
better
approach than the path down which I had been going.

Art