Professional Documents
Culture Documents
Chapter2 OOPConcepts
Chapter2 OOPConcepts
Object-Oriented
Programming Concepts
FALL22
Safae Bourhnane
Chapter ILOs
• Cohesion
• Encapsulation
• Information hiding
Abstraction
What is Abstraction?
Examples
• Washing machine
• Coffee maker
• Computer
Other examples?
Cohesion
Problem: putting too many functionalities into one object
Hiding information isolates clients from requiring intimate knowledge of the design to
use a module, and from the effects of changing those decisions.
Information Hiding
What is wrong?
Information Hiding – Access Control
The class has to expose only what is necessary to the Why do we need access control?
client programmer and keeps everything else hidden:
Access Control.
• Accessors/getters: public methods that give information about the state of the object
• Mutator/setter: public methods used to modify the state of an object without explicitly
showing how data gets modified