私有類數據模式(Private class data pattern)

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

這種私有的數據類程序設計模式的目的,通過控制一些屬性的可見性,來減少暴露在外的屬性的數量。由於把這些類的屬性包裝到一個數據對象中,可見的類的屬性就減少了。類的屬性的賦值就只能在實例化時完成,目標類的方法也不能對這些屬性的值進行操作。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章