- Private class data pattern
Intent
The private class data design pattern seeks to reduce exposure of attributes by limiting their visibility. It reduces the number of class attributes by encapsulating them in single Data object. It allows the class designer to remove write privilege of attributes that are intended to be set only during construction, even from methods of the target class.
Consequences
The consequences of using this design pattern include the following:
Controlling write access to class attributes;
Separating of data from methods that use it;
Encapsulating class attribute (data) initialization; and
Providing new type of final: final after constructor.
http://en.wikipedia.org/wiki/Private_class_data_pattern
No comments:
Post a Comment