Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing controls from a form
Message
 
 
To
09/03/2021 08:59:43
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01678811
Message ID:
01678824
Views:
36
>>Thank you. One thing I could never understand is the concept of "factory". How would you explain it in other words?
>
>A factory? Something that tells your code what to use. cClass in newobject and addobject need not to be hardcoded. It's a string and might be altered or read from somewhere.
>
>There are many approaches. Just an example.
>
>Think of the following
>Instead of
>
THIS.AddObject(cName, cClass [, cOLEClass] [, aInit1, aInit2 ...])
>you do
>
Factory._AddObject(cName, cClass, THIS[, cOLEClass] [, aInit1, aInit2 ...])
>
>now factory checks, for example from a table, if there is a replacement for "cClass" to be used. Depending on settings of your app, or a patch class depending on a patch issued, or debug state. Then Factory will run for the object send as parameter
>
oObj.AddObject(cName, cNewClass [, cOLEClass] [, aInit1, aInit2 ...])
>
>Or you just alter the code of your base classes addobject to call the factory to return the altered class, and dodefault to instantiate the returned class. This is more easy - no fiddeling with datasession.
>
>You can do this on newobject or createobject as well.
>Sooner or later one will handle anything through it, then the basic call will use a UUID for cClass, and any return is from the factory.
>
>google, there are some articles about it. I've not invented it myself ...

Thank you. I am still confused. In your example, above, is Factory some kind of a class?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform