Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Possible WISH LIST item?
Message
 
 
To
24/10/1998 11:52:22
Eric Barnett
Barnett Solutions Group, Inc
Sonoma, California, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00149579
Message ID:
00150189
Views:
35
Eric,

You are not butting in at all.

>I think reference counting is a HUGE plus and fairly mandatory to a good OOP language. I don't know how you would get by without it. The only problems I've ever encountered are when my classes are not well encapsulated and have dependencies on other objects that they are not responsible for and just expect to exist. I've learned (through some trial and error) that this is always bad design.

I too hate to design with a requirement that some external object exist. I usually end up coding a UDF that will first look to see if it's out there and return a reference, otherwise it instantiates it. I definately minimize this type of thing though, but at some point a framework becomes complex enough that it's hard to avoid it.

>Objects should always instantiate and release all resources that they require. I can't think of a properly designed example where I would want to release the resources of an object that was in scope somewhere else. I would, however, want all of those resources to be release when the object was no longer in scope ANYWHERE. The goServer example from earlier in the thread is the best example. Why would I want to be coding in each client for the existence of goServer? And then, if it's not there and I need it I'll probably have to re-instantiate it, with every one probably ending up with their own copy of the object afterwards.

That's why I use a singleton pattern with a UDF to seek out the server and instantiate it if it's not there already. I use a UDF precisely to avoid duplicated code inside class methods.

>The References[] collection is a better idea, in my opinion, if such a thing is possible. From what I understand about the way reference counting mechanisms work it would be difficult.

The backwards pointers to the references are fraught with perils of their own *s*

And the worst problem I had was in a classlib parser that created several double linked lists of nodes. There was just no way to ever get everything to properly release. I had to create a single linked list of allocated nodes in the lowest level node class that provided a way to get to every node so that they could set their pointers .null.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform