I am cleaning up some code in a class that has a settable property, with a local variable holding the value.
Some parts of the code currently call externally to get the value rather than using its own property, other parts sometimes use the property itself whilst in others the local variable is used.
In this case the property is simply set by the factory method that creates an object of this class, so the property always is the same as the variable. However I am not sure that I should be assuming this is the case in the code I am writing as that makes it harder in the future to add logic behind the getter method.
Is this something where either might be right, or am I forgetting something basic in my OO principles?
To reduce complexity and increase maintainability.
First thing you should do is reduce the number of places an item exist (which you seem to be doing).
Next you should use any language tricks to reduce the size of the code. For exmaple in some versions of c# you don’t need to declare fields to hold values of properties.
Once you done this you can chooses either method – there is not performance optimisation that comes from one over the other. But to be consistent. That is will increase maintainability.
Personally I prefer to always use properties where I can.