There is this new class I'm making. Let's say its called "SuperSearch".
It has some methods, that only make sense if called during an event.
Let's say I have the method "LengthySearch". LengthySearch calls an
event in the subclasses, to pass back collected data. Let's say the
event is "HeresAFoundItem(Item as Item)".
Now let's say that at this point, where a found item is returned, the
subclass may want to find information on how the item was found. It
might be something like method "WhereWasTheItemFound".
The thing is, method "WhereWasTheItemFound() as string" has no
meaning, if not called from within the event "HeresAFoundItem".
How to manage this?
The reason that I don't simply just pass the string information about
where the item was found, as a parameter to HeresAFoundItem, making
it like "HeresAFoundItem(Item as Item, Where as string)" is that
"where as string" may take a long time to compute, because the
information is not stored as a string but as a complicated data type.
So for speed purposes, it will often be much more efficient to not
force the class to return results which are not necessary.
So how to do manage this?
How can I signify that these methods should only be called during the
event, is there a good naming convention? Something like
"WhereDuringEvent() as string"?
Or can I hide the methods somehow that should not be called outside
of the event, so that they can only be called during the event? Maybe
return a typecasted version of my "SuperSearch" instance, as a class
interface with a public declaration of a private method? That is
"WhereWasTheItemFound() as string" would be a private method, but
exposed via a class interface that it implements?
Interesting problem eh?
It's an awkward one!
--
http://elfdata.com/plugin/
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>