>I was happily building business objects, and suddenly I noticed I was doing method calls to the objects two different ways. All the objects work off parameterized views of the data; some methods operated on "pre-existing data", while others passed the parameter and fetched a new data set.
>
>Because this is a recipe for programmer frustration, some of the methods are going to change, but which ones..? Which methodology is better, and why?
>
>Or would it be better to recode them all so that no parameter worked on the current data, and a passed parameter requeried before acting?
>
>Chris.
Chris,
It'd depend.
In most cases I tend to use last option where applicable. ie: Think of VFP functions. Most of them work on 'current' if no parameters are specified :
use Table1 in 0
use Table2 in 0
*..
select Table1
? tag()
? tag(1) && Override
? tag(1,'Table2')
OTOH there are functions that need at least one or more parameters be specified :
? seek(NonOptionalParameter)
And where applicable I tend not to display any parameter error in the function/procedure/method itself but inform the caller routine (mostly thinking my routine could be used as a COM dll where no UI allowed or it should be caller routine's responsibility to provide UI - ie: I'd like to have something like use('myTable','exclusive') over 'use myTable exclusive'). Good try..catch is coming :)
Cetin