Home Segments Top Top Previous Next

242: Mainline

Most good programmers provide getters and setters for some instance variables, but do not provide them for others. The choice is a matter of taste and style. Until you have developed your own taste and style, you should rely on the following heuristic: Whenever the detailed implementation of a class may change, provide instance-variable getters and setters to insulate your class-using methods from the potential change.