In the app I'm working on, we have a table class that displays data. The user can load and reload data at various times, calling the table's load() method. I need to do one bit of logic ONLY on the first time load() is called. I'm considering using a boolean flag so I can check whether or not it's the first. But I seem to recall a fellow programmer or two turning their nose up at using flags in general....
as mentioned above: if you can not check the state then you have to add a "flag". perhaps you can "abuse" a different field ? e.g.
if they keep their noses up.... just call it "state" instead of flag, make it an int and assign it another value after each "phase" (e.g. init, load, reload, delete, flush or wahtever you have) :-)
Joined: May 07, 2001
Ok - Thanks for your support, guys. I'm gonna go ahead & use the flag. I tried "abusing" an existing field, but it didn't work out. I think these people "learned" something about a particular situation where maybe using the flag was bad, & are trying to over-apply it.