2015-08-13 23:54:40 +02:00
|
|
|
---
|
|
|
|
layout: pattern
|
|
|
|
title: Private Class Data
|
|
|
|
folder: private-class-data
|
2015-08-15 18:03:05 +02:00
|
|
|
permalink: /patterns/private-class-data/
|
2019-12-13 21:09:28 +02:00
|
|
|
categories: Idiom
|
2015-12-28 15:52:44 +02:00
|
|
|
tags:
|
2019-12-13 21:09:28 +02:00
|
|
|
- Data access
|
2015-08-13 23:54:40 +02:00
|
|
|
---
|
|
|
|
|
2016-01-03 21:14:30 +01:00
|
|
|
## Intent
|
|
|
|
Private Class Data design pattern seeks to reduce exposure of
|
2015-08-13 23:54:40 +02:00
|
|
|
attributes by limiting their visibility. It reduces the number of class
|
|
|
|
attributes by encapsulating them in single Data object.
|
|
|
|
|
2019-12-07 20:01:13 +02:00
|
|
|
## Class diagram
|
2015-08-13 23:54:40 +02:00
|
|
|

|
|
|
|
|
2016-01-03 21:14:30 +01:00
|
|
|
## Applicability
|
|
|
|
Use the Private Class Data pattern when
|
2015-08-13 23:54:40 +02:00
|
|
|
|
2019-12-13 21:09:28 +02:00
|
|
|
* You want to prevent write access to class data members
|