R
rowe_newsgroups
That is why I asked you to tell me the logic, in other words, why do we
You're correct that we shouldn't care how the value is returned, but
in practice it's rather important (you wouldn't want the Get of a
property doing a 15 second return every time you called it).
In my experience it is generally safer to bet that a property will do
less work than a function when it comes to returning a value. This of
course isn't always true, as it relates to coding styles and (imo)
skill level and experience of the developer who wrote the library. In
most cases it is assumed that a property usually returns a simple
value, where as a function does something in the background to get
that value. For example it's common for a function to end up querying
a database, but I would beat any of the developers I work with for
doing this from a property unless they had an extremely good reason.
(I wonder if I put enough words like "usually", "imo", "generally",
etc to cover myself?)
Thanks,
Seth Rowe [MVP]
http://sethrowe.blogspot.com/
need on the caller side to know what work is done on the sender side.
AFAIK is one of the principles of Oop that nobody should care how something
is returned, only that it is returned.
You're correct that we shouldn't care how the value is returned, but
in practice it's rather important (you wouldn't want the Get of a
property doing a 15 second return every time you called it).
In my experience it is generally safer to bet that a property will do
less work than a function when it comes to returning a value. This of
course isn't always true, as it relates to coding styles and (imo)
skill level and experience of the developer who wrote the library. In
most cases it is assumed that a property usually returns a simple
value, where as a function does something in the background to get
that value. For example it's common for a function to end up querying
a database, but I would beat any of the developers I work with for
doing this from a property unless they had an extremely good reason.
(I wonder if I put enough words like "usually", "imo", "generally",
etc to cover myself?)
Thanks,
Seth Rowe [MVP]
http://sethrowe.blogspot.com/