>>Hi Gregory,
>>
>>First, thank you for sample code. It does look straight forward. I am not arguing that the collections approach is valid. Aside from my concern for making a mistake in something that I have never used before and breaking an existing application (which I am refactoring), I have the following point. Why is collections (in this particular case of storing a bunch of names) better than array? Array - with the help of an INLCUDE file - can be addressed with "key" names too.
>
>
>Dmitry,
>
>In this case, it is not better at all. Just a minor detail - if you add/delete something later you'll have to change the dimension of the array
>
>The nice things about a collection are (I may be missing a few)
>- you can subclass it, and add functionality
>- it grows/shrinks dynamically as items are added/deleted
>- you cannot add any property/function to an array
>
>see message#
1404171 for an example of creating a Queue and a Stack class based on collection
>
>
>In my collection base class I have eg changed the base Add() to return a bool if Add() fails (so try catch needed)
>Same with retrieving data from the collection
>I can clone() it
>Stacks/queues, I can reverse
>.....
>All written once and scoped to the collection
>With an array, I would have a lot of functions scattered around
>
>Also you can test whether a collection is empty, whereas with a (foxpro) array you cannot
>
>I avoid arrays when I can
Gregory,
Thank you for making a case for collection class. I will also review the message you references.
"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