A writeable property is clearly different than a function.
I thought the only thing we were discussing was read-only
properties.
So I assume you
meant read only properties. A read only property is indeed quite
similar to a function,
I see no reason to use a property Get for a read-only return value
in a standalone module. In a class module, whether standalone or
not, yes, it makes perfect sense, as it is a property of the object.
In a standalone module, it's publicly available (if it's public; if
it's not it's available only in that module, and that makes even
less sense to me).
and generally to choose between a read only property and a
function is a matter of 'relation' and sometimes about the 'amount
of computation'. As example, in general, a random number generator
would sound strange for a property, because the randomness is
hardly owned by anything; and a name is probably better as a
property than as a function. But in the end, it is a matter of
preference, I agree.
I write a lot of functions that initialize from some value looked up
or supplied from literal values, and stick the looked up value in a
static variable inside the function. Here's an example:
Public Function Workstation() As String
Static strWorkstation As String
If Len(strWorkstation) = 0 Then
strWorkstation = fstrGetWorkstation()
End If
Workstation = strWorkstation
End Function
This is not something that needs to be queried from the OS each
time, as it can't possible change within a single Access session.
Also, while I'm coding in an MDB, this kind of code is self-healing,
whereas something that depends on a module-level variable getting
assigned and staying assigned will not work as well.
I also like having the variable defined inside the function that
uses it, instead of in the module-level variables. That has two good
side effects:
1. it's internal to the function and quite clearly associated with
it.
2. it can't be changed from outside the function, accidentally or
otherwise, unless you have an argument for your function that allows
you to do that.
To me, these are functions, returning values looked up from
elsewhere, not properties of an object within your application.
Thus, they should be defined as functions, not as properties (even
though defining as properties would have exactly the same effect in
terms of use in code).