Re: Breaking the Last Dependency in C++?



Daniel T. wrote:

In article <4338f75e$0$11868$3b214f66@xxxxxxxxxxxxxxxxxxxx>,
Joerg Simon <j_simon@xxxxxx> 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

-------
On java.net there is an article from Elisabeth Freeman and Eric Freeman,
in advice of Erich Gamma claiming to "break the last dependency",
meaning that factories still are fixed to implementations (new ops) and
there can be something better. So they indroduced the idear of a factory
which uses Reflection and File-IO to create the factory-products.

That there are arguments that the code is slow/could be better... and so
on doesn't concern me, my question is, is there an Equivalent in C++?

Since I know Java quite well {kind of ;) }, but are, hm, intermediate in
C++ (I know what Templtes, Template-specializations and so are and some
of std c++ [one year working with it on the University], and have some
minor knowledge of boost [gregorian time and sharet pointer]), I don't
know if there is a technology in c++ which supports this kind of dynamic
creation.

I noticed that no one actually answered this question so: Yes.

Andrei Alexandrescu came up with the method and published it in his book
"Modern C++ Design: Generic Programming and Design Patterns Applied"

It can also be found @ <http://sourceforge.net/projects/loki-lib/>


I don't wish to be contentious but doesn't that make the answer no?
AFAIK C++ still has no easy and direct language support for virtual
construction. The only language I've used that can do it is Perl.

Using the loki library may break the last depenency in one sense but
only by shifting it to another place, namely a dependency on that
library. Luggage I won't want to carry.

Although that seems like an interesting book so thank's for the link
;-)

Cheers

.



Relevant Pages

  • Re: Breaking the Last Dependency in C++?
    ... 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 ... On java.net there is an article from Elisabeth Freeman and Eric Freeman, ...
    (comp.object)
  • Breaking the Last Dependency in C++?
    ... Is there an equivalent technique for a factory like one with refelction ... On java.net there is an article from Elisabeth Freeman and Eric Freeman, ...
    (comp.object)
  • Re: Constants, Static, Public, Private
    ... Does there exist a program behaviour which could be implemented using the "FACTORY" keyword, but which could not be implemented without that keyword? ... word 'static' when used in Java. ... public static void main{ ... Classes basically represent a class of objects (e.g. a class called "Dog" might represent the abstract concept of what a dog is like, and how it should behave, while a particular instance of "Dog" represents one particular dog). ...
    (comp.lang.cobol)
  • Re: Constants, Static, Public, Private
    ... Constants were introduced by J4 as a part of COBOL 2002 - a short ... COBOL instance methods are equivalent to public nonstatic methods in Java. ... COBOL factory methods are equivalent to public static methods in Java. ... factory method must invoke instance methods to act on instance data. ...
    (comp.lang.cobol)
  • Constants, Static, Public, Private
    ... Constants were introduced by J4 as a part of COBOL 2002 - a short ... COBOL instance methods are equivalent to public nonstatic methods in Java. ... COBOL factory methods are equivalent to public static methods in Java. ... factory method must invoke instance methods to act on instance data. ...
    (comp.lang.cobol)