Forums Register Login

CMP, abstract methods & encapsulation

+Pie Number of slices to send: Send
Hello there,

This may be a stupid question, but can anyone explain to me WHY creating abstract getter / setters for the virtual persistent fields provides better encapsulation if the implementation of the getter / setter (the ones that are exposed on the component interface and you also implement on the bean class) just calls the abstract getter / setter method.

Thank you
Marcos
+Pie Number of slices to send: Send
So that you can change the type, number, and nature of the (encapsulated) virtual fields in the future, without necessarily having to change the (exposed) component interface.

Typically that happens when you start storing fields that you used to derive (or calculate) - or when you find a way to derive (or calculate) a field and you no longer want to store it.
+Pie Number of slices to send: Send
Thank you! You made it clear now!
If you want to look young and thin, hang around old, fat people. Or this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 561 times.
Similar Threads
K&B encapsulation concept
BJO - 3 main feature of OOP
Encapsulation and getter&setter methods
Encapsulation vs Data/information hiding
getName()
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 07:10:56.