Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
NewObject or CreateObject or AddObject
Message
 
To
27/08/2007 16:16:40
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01250745
Message ID:
01250834
Views:
13
This message has been marked as the solution to the initial question of the thread.
If you can always use CreateObject() because it's considerably faster than NewObject(). In fact NewObject() is dreadfully slow as it tries to locate libraries all the time you create a new object. When I say dreadfully slow - that's comparatively. It's still pretty fast but compared to plain CreateObject() perf is substantially slower.

That said NewObject() is more maintainable because it explicitly references libraries, but on a typical project that usually shouldn't be a problem because you'll have a place to place initialization code.

+++ Rick ---

>I was passing in an object, oHandler, to another object, oxServer, but decided I want to create oHandler inside oxServer instead, to keep everything encapsulated so references are easier to make. What decides when to use NewObject, CreateObject or AddObject? I was using CreateObject for oHandler, then passing it in, but what's the correct way to do it inside oxServer? Why?
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform