Re: Breaking the Last Dependency in C++?
- From: "Daniel Parker" <danielaparker@xxxxxxxxxxx>
- Date: 27 Sep 2005 07:41:48 -0700
Joerg Simon wrote:
> Hi experts,
>
> Short:
> -----------------------------------------------------------------------
> Is there an equivalent technique for a factory like one with refelction
> in Java like in the article of Elisabeth Freeman and Eric Freeman on
> Java.Net?
> -----------------------------------------------------------------------
>
> Article URL:
> http://today.java.net/pub/a/today/2005/04/14/dependency.html
>
> -------
This is a fairly common technique technique in Java, the XML parser and
XSLT transformer factories, for example, all work this way. Freeman
and Freeman aren't really introducing anything new here. Since it
relies on reflection, on being able to create an instance of a class
from the class name, there is nothing directly comparable to it in C++,
which doesn't support that. The closest to this in C++ would be to
have the factory look up an instance factory in a map associated with a
name. The lookup table could be in a dynamic or shared library, and
the names registered in a configuration file, allowing some scope for
extendibility. But in general languages that support reflection offer
much greater scope for exendability.
Regards,
Daniel Parker
.
- Follow-Ups:
- Re: Breaking the Last Dependency in C++?
- From: iamfractal
- Re: Breaking the Last Dependency in C++?
- References:
- Breaking the Last Dependency in C++?
- From: Joerg Simon
- Breaking the Last Dependency in C++?
- Prev by Date: Strategy or A factory with Template Method
- Next by Date: Re: Why encapsulate state pattern......
- Previous by thread: Breaking the Last Dependency in C++?
- Next by thread: Re: Breaking the Last Dependency in C++?
- Index(es):
Relevant Pages
|