Presentation is loading. Please wait.

Presentation is loading. Please wait.

Encapsulation. Encapsulation Encapsulation means the bringing together of a set of attributes and methods into an object definition and hiding their implementational.

Similar presentations


Presentation on theme: "Encapsulation. Encapsulation Encapsulation means the bringing together of a set of attributes and methods into an object definition and hiding their implementational."— Presentation transcript:

1 Encapsulation

2 Encapsulation Encapsulation means the bringing together of a set of attributes and methods into an object definition and hiding their implementational structure from the object's users. Therefore, how an object structures and implements its attributes and methods is not visible to other objects using it.

3 Encapsulation Direct access to an object's attributes is not permitted and any changes to the object's data can only be effected indirectly via a set of publicly available methods. Analogy: Egg ◦ Yolk  attribute ◦ White  method

4 Bundling & Information Hiding Encapsulation is supported by two subordinate concepts: bundling and information hiding. Bundling is the act of associating a set of methods with a set of data as the only means of affecting the values of the data. Related data and methods are therefore brought together in bundling, thus increasing the cohesiveness of object definition.

5 Bundling & Information Hiding Information hiding refers to the hiding of internal representation of data and methods from the users of these data and methods. By exercising information hiding, data access on an object is limited to a set of publicly available methods.

6 Bundling & Information Hiding Information hiding enables the separation of the what from the how of object definition. What specifies what behavior an object is capable of and how specifies how the data and methods of an object are implemented.

7 Enhanced Software Maintainability By separating what from how, a client’s access to an object is not affected by changes in the internal implementation of the object. This enhances software maintainability. Ilustrasi  stack


Download ppt "Encapsulation. Encapsulation Encapsulation means the bringing together of a set of attributes and methods into an object definition and hiding their implementational."

Similar presentations


Ads by Google