A common problem for me - and it's not really a problem, but somehow I again and again ask myself, what is the normal way to handle this - is that there is a method and within this method a couple of variables are created, used and finally are supposed to be retained as instance variables.
Somehow I want to avoid dot notation, so I prefer variables to be local in a method instead accessing instance variables. Indeed only sometimes access time really matters cause the difference is not so big, but also when there are several variables with already longish descriptive names, if all these are referenced with
self. it makes everything even longer and things become IMO less readable. This is why I tend to do have everything local and in the end of the method "save" it as instance variable. For instance
classdef myclass < handle properties basal_blood_pressures ... end methods function obj = myclass() end function output = verifyBloodPressures(obj, p) basal_blood_pressures = getBloodPressures('basal', p); n = numel(basal_blood_pressures); output = zeros(n); for ii = 1:n basal_blood_pressures(ii) = basal_blood_pressures(ii) ... ... output(ii) = ... end % Attach all variables to instance here % instead of doing it right in the beginning obj.basal_blood_pressures = basal_blood_pressures; obj.blood... obj... end end end
But doing this attachment in the end also does not "feel right" somehow. Any advice on this? Is there any good way how to proceed here?