This is the concept that I have tried hard to understand, but I have never fully achieved it.
I'll take this excerpt from a Deitel book to illustrate:
It is better software engineering to define member functions outside the class definition. This practice ensures that programmers do not write a client code that depends on your implementation of the class. If they needed to do this, the would break if the class implementation were changed.
I can not understand how it would be possible for the client to write code that depended on the implementation of the class, since the local variables of the method and the private
fields of the class are inaccessible anyway.
Could anyone illustrate a practical example of code in which this could happen? An example of an exposed library method in which the user would use something specific to the implementation of this method in his code and then a possible change of that implementation by the creator of the library that would break the client code. I need an example to be able to understand. I've seen millions of conceptual explanations, but none of them made sense to me.
In my view of lay people, I think it is more interesting to make implementations visible since the programmer may be curious about how such a method works, just as someone might want to know why pushing a radio button station changes, for example.