bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re[2]: New By Name


From: Mike Papper
Subject: Re: Re[2]: New By Name
Date: Thu, 25 Sep 2003 10:02:42 -0700

The main reasonm for new_by_name (as opposed to the whole java reflection 
API) is so clients can pass the classname of the function(ality) that should 
process the data along with the message. The server can (attempt to) 
instantiate the class and pass the rest of the data in the message to get the 
work done. This way, the server can stay dumb.

I think at the end of the day a factory versus new_by_name is the same thing 
(in C++) - its alist of mappings from classnames to code to create new classe 
instances.

Mike Papper

On Thursday 25 September 2003 02:13 am, Andrey Kulikov wrote:
> Hi All.
>
> >> I would like the Java introspection functionality - or at
> >> least to be able to
> >> create an instance of a class from its name. This would mean
> >> there is no need
> >> for "Factories". I call this feature "new by name" because
>
> From my point of view the main advantage and reason for using
> "Factories" is hiding from clients real implementation of
> requested interfaces. I.e. if i request interface 'Logger from
> 'LoggerFactory', it does not matter for me, what the implementation of
> this interface - 'FileLogger', 'DBLogger' or 'SMTPLogger'.
> And if i explicitly specify a name of class - how can i forget about a
> Factories?
>
> And what the motivation for implementing this Java reflection API like
> stuff?
>
> >> An example on how to use it:
> >> ChildClass cl = (ChildClass)new_by_name("Children_of_ChildClass");
>
> PB> Take a look at the persistence engine.
>
> PB> There are some subtilities (it seems to me that the class name is
> written PB> only once and then only short class ids instance of the class
> name, ...)
>
> Yes, using persistent container is a good idea.
> But implementing this is a very complex task, and purchasing it is
> very expensive. All the more i don't know good open source C++
> persistent container. :(
>
> And opinion on this question is that in complex cases is only one way
> for make instances of classes by name - persistent layer in
> application of something like CORBA.
> And in simple cases it not necessary, and can be implemented by other ways.

-- 
Mike Papper
Fantastic
address@hidden
650-356-2113




reply via email to

[Prev in Thread] Current Thread [Next in Thread]