Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CreateObject() vs NewObject()
Message
 
To
22/08/2007 14:33:49
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP1
Miscellaneous
Thread ID:
01249678
Message ID:
01249683
Views:
29
Hi Dragan,
NewObject() is slower then CreateObject()

MartinaJ

>Attempting to make a (sort of) final list of pros and cons for both approaches:
>
>CreateObject() with Set Classlib + Set Procedure
>Pro:
>- you only need the name of the class and don't care where is it defined
>- you don't need to specify any extra parameters when creating it
>- if you move a class (from prg to vcx, vcx to prg, vcx to vcx, prg to prg), the createobject() commands don't need to be touched at all
>Con:
>- you need to maintain the Set Classlib + Set Procedure lists (can be automated, I did that)
>- when something goes wrong, you have no clue where the class is defined, unless you got a good output from aStack(); if no error but still need to fix something, only Code References can help you
>
>Newobject() with 2nd parameter
>pro:
>- no need to maintain Set Classlib + Set Procedure lists
>- you can have a class with the same name in a different location and still instantiate it (not that anyone sane would do that)
>- when you read code, the location of the classlib is obvious
>con:
>- you must know where your class is
>- if you move a class, all the newobject() calls need to be edited (or you should use a factory)
>- you must specify the extra parameters in newobject()
>
>I have probably forgot some... so add.
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform