What do you do to avoid this? I try to name my heavy-lifting methods so that they do not look like simple accessors, but sometimes it is inevitable.
For instance, a large dataset may have a method to get the length of the dataset. If the dataset does not maintain a member variable that has that value, then you have to calculate it. Later, for performance, you might implement an ivar that is updated whenever the dataset changes, thus making the method a simple accessor.
For instance, a large dataset may have a method to get the length of the dataset. If the dataset does not maintain a member variable that has that value, then you have to calculate it. Later, for performance, you might implement an ivar that is updated whenever the dataset changes, thus making the method a simple accessor.