How to hide information in modulation?

How to hide information help separate the modules that make up the system?

+3
source share
2 answers

Encapsulation (hiding information) allows you to set only an absolute minimum in the outside world. This means that you can change unused bits in your heart content without affecting clients.

Random example. Suppose you have implemented a data structure that contains rows in an array. If you expose an array, users of your data structure can simply use str[7]to get the row at position 7.

, , , . , , , .

, , . , , .

, :

String getStringAt (int n);

, .

, (API) .

, , , . , , ( ), .

, , , API. , API, - .

+10

, .
, - , , , //call-it-what-you-may, "" .

, API, , , API , interop. ( , , - A, x B ( B x, , !)

+1
source

Source: https://habr.com/ru/post/1721363/


All Articles