When I'm developing a class, I find it helpful to group the methods into two categories. Core methods are methods that know about the implementation of the object and depend on it to get their work done. Non-core methods don't really know how the implementation works. Instead, they call the core methods to access and to change the representation. The non-core methods provide extra utilities which users of the class would find useful. For example, a collection may have a method called size which is a core method. The method isEmpty is non-core since it just calls size and compares the answer to zero
I try to make my set of core methods as small as possible. When I find methods that call core methods but also directly access the implementation, I start to wonder if I'm missing a core method. Obviously, there was something that this method needed to do that wasn't covered by a core method so it accessed the implementation itself to do it. I can usually refactor the method so that it's a completely non-core method by adding additional core methods. This makes the implementation easier to modify because you now only need to modify the core methods to change the implementation.
Download