From 08cec0e254edd54bc4947d3e6c4bb5b044867edd Mon Sep 17 00:00:00 2001 From: Wei Seng Date: Sun, 9 Aug 2020 03:10:43 +0800 Subject: [PATCH] Update README.md --- private-class-data/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/private-class-data/README.md b/private-class-data/README.md index 0cd771bab..b751c4fe9 100644 --- a/private-class-data/README.md +++ b/private-class-data/README.md @@ -18,12 +18,15 @@ attributes by encapsulating them in single Data object. Real world example > Imagine you are cooking a stew for your family for dinner.You want to prevent your family members from comsuming the stew by tasting it while you are cooking, otherwise there will be no more stew for dinner later. + In plain words > Private class data pattern prevent manipulation of data that is meant to be immutable by seperating the data from methods that use it into a class that maintains the data state. + Wikipedia says > Private class data is a design pattern in computer programming used to encapsulate class attributes and their manipulation. + **Programmatic Example** Taking our stew example from above. First we have a Stew class where its data is not protected by private class data, making the stew's ingredient mutable to class methods.