Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFUG article by Nancy Folsom
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00713831
Message ID:
00714222
Views:
44
Ed,

> VFP is not the best environment for a linked-list solution; surprise; ... Nancy took the position of 'this is something VFP doesn't do well; C# is a better choice'; the same applies in the other direction as well.

Ok, I'll take umberance at the above statement. bait.. bait.. *bg*

I used a binary tree example in the PTF-OOP book as one example of how advanced data structures could now easily be created in VFP.
define class DoubleLinkedList as custom
oLeft = .null.
oRight = .null.
enddefine

oX = createobject( "DoubleLinkedList" )
oX.oRight = createobject( "DoubleLinkedList" )
ox.oRight.oLeft = oX

* now we have a doubly linked list
Most advanced data structures (trees, lists, graphs, etc.) involve pointers. VFP object references server perfectly well in this capacity. I think VFP works just as good as any other language I use/have used, that supports pointers, in creating these data structures.

I've worked off and on for a while on a class library documentation tool that uses 4 pairs of doublelinkedlist pointers in each of the nodes. They link superclass/subclass, containership parent/sibling, classlib packaging and node allocation.

For the lurkers I'm not mono-lingual and have always recommended using the right language where appropriate.

I agree that advanced data structures go pretty much over the heads of most xbase programmers. But to anyone though that has taken sophmore level CompSci courses they've at least written a program or two that uses a tree or linked list.
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