J
Jeff Robichaud
Hello,
I have an obect that needs to inform the outside world wheter prices are
synchronized or not. My first idea was to use a public property for this:
public bool PricesSynchronized
But I need to access a database and the query takes a (relatively) long time
to run. So for any code that will use this property, I just find it strange
that it's going to take time, because usually a public property is used to
simply publish some internal data, sometimes performing simple calculations,
sometimes just preveting write acces to internal data (using get without
set).
I have never seen a property that takes time to process so I would tend to
use a method here instead. But on the other hand, methods are usually used
to perform tasks on the object, whereas properties are used to get some info
about the object...I know this is somehow philosophical but what would be
the best choice here (from a design point of view) ??....
I have an obect that needs to inform the outside world wheter prices are
synchronized or not. My first idea was to use a public property for this:
public bool PricesSynchronized
But I need to access a database and the query takes a (relatively) long time
to run. So for any code that will use this property, I just find it strange
that it's going to take time, because usually a public property is used to
simply publish some internal data, sometimes performing simple calculations,
sometimes just preveting write acces to internal data (using get without
set).
I have never seen a property that takes time to process so I would tend to
use a method here instead. But on the other hand, methods are usually used
to perform tasks on the object, whereas properties are used to get some info
about the object...I know this is somehow philosophical but what would be
the best choice here (from a design point of view) ??....