Beware of many accessors

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
(New page: If there are too many accessors for fields within a class (especially public accessors), that indicates there are large number of requests requiring thoes fields. If a class is designed pr...)
 
Line 1: Line 1:
If there are too many accessors for fields within a class (especially public accessors), that indicates there are large number of requests requiring thoes fields. If a class is designed properly, only a small portion of the class should be usable by the external classes, other parts should be methods which assit the class to implement its behaviour. Hence too many client requests for field values either means the class is not supporting its own behaviour very well or some unrelated things have been put into the class.
+
If there are too many accessors for fields within a class (especially public accessors), that indicates there are large number of requests requiring thoes fields. If a class is designed properly, only a small portion of the class should be usable by the external classes, other parts should be methods which assit the class to implement its behaviour. Too many accessors indicate the related data are not placed together. In addition, too many client requests for field values either means the class is not supporting its own behaviour very well or some unrelated things have been put into the class (which breaks the single responsibility principle).

Revision as of 10:49, 7 October 2008

If there are too many accessors for fields within a class (especially public accessors), that indicates there are large number of requests requiring thoes fields. If a class is designed properly, only a small portion of the class should be usable by the external classes, other parts should be methods which assit the class to implement its behaviour. Too many accessors indicate the related data are not placed together. In addition, too many client requests for field values either means the class is not supporting its own behaviour very well or some unrelated things have been put into the class (which breaks the single responsibility principle).

Personal tools