On Thu, 24 Aug 2006 16:24:09 -0500, Guyren Howe <[EMAIL PROTECTED]> wrote:
On Aug 24, 2006, at 3:10 PM, Alexander Cohen wrote:

Does anyone know of any code hacks that would allow a developer to
instantiate a custom class from within the IDE by name?

example:
dim instance as Object = NewInstanceOfObjectByName("MyCustomClass")

This is an example of something you could implement elegantly with
"first class classes" (classes that are themselves objects). If you
are interested in this capability, sign on to <http://
www.realsoftware.com/feedback/viewreport.php?reportid=ngrccqde>.

Until then, your simplest solution is a dirty big case statement.

Sorry, but IMHO the simplest solution is a "class-factory"

Define a dictionary e.g. in the App (or better some where else, so your code is protable between Applications) and add the classes during start up

        ClassFactory.Value("myName") = new myNameClass


What I suggest is a method "ObjectClassName" for all this classes, so you're able to retrieve the name of the class of a given object during runtime.

Of course you can extend this in a lot of varieties, but the basic is use a class-factory.

Btw. for all "this is possible in ...."-criers, e.g. for "Java" of course you can create classes on the fly dynamically while the applications are running, but in average these classes are way slower then a default defined and create class in source code. For some "minor" classes this may not count for real-world-usage, but some years ago we had to refactor a very big application completely to speed it up from unusable to fast! So even in environments where you're able to create classes dynamically it makes sense to know about the class factory.


ciao

Thorsten Hohage
--
that-Office.de Softwaredesign - Hamburg,Germany


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to