Home » , , , , , » Basic Concepts - Object Oriented Programming

Basic Concepts - Object Oriented Programming

 Basic Concepts - Object Oriented Programming 

  
In this lecture, we will discuss some basic concepts of Object Oriented Programming. Actually we are going to explain main components of OOP and we will see that whole OOP revolve around these basic concepts. We will discuss,  


  1. Information Hiding
  2. Encapsulation
  3. Interface
  4. Implementation
  5. Separation of Interface & Implementation
  6. Messages
Information Hiding


In OOP, information hiding is one of the most important principles that inspires from real life which says that all information should not be accessible to all persons. Private information should only be accessible to its owner.


By Information hiding, we mean “showing only those details to the outside world which are necessary for the outside world and hiding all other details from the out side world”.


Real life Examples of Information Hiding


  1. Kashif’s Name and other personal information is stored in his brain, we can not access this information directly. For getting this information we need to ask Kashif about it and it will be up to Kashif how much details he would like to share with us.
  1. An email server may have account information of million of people but it will share only our account information with us if we request it to send anyone else account information our request will be refused.
  1. A phone SIM card may store several phone numbers but we can’t read the numbers directly from the SIM card rather phone-set reads this information for us and if the owner f phone has not allowed others to see the numbers saved in this phone, we will not be able to see those phone numbers using phone.
In OOP approach we have objects with their attributes and behaviors that are hidden from other classes, so we can say that Object Oriented Programming follows the principle of information hiding.




In Object Oriented Programming – Information Hiding is,

“Hiding the object details (state and behaviors) from the users”


Here by users we mean “an Object” of another class that is calling functions of this class using reference of this class object or it may be some other program in which we are using this class.


Information Hiding - Principles


Information Hiding is achieved in Object Oriented programming using following principles,


  • All information related to an object is stored within object.
  • It is hidden from the outside world.
  • It can only be manipulated by the object itself.
Information Hiding – Advantages


Information Hiding has two major advantages of information hiding,


  • It simplifies our Object Oriented Model
As we saw either that our Object Oriented Model only had objects and their interactions hiding implementations details so it makes it easier for everyone to understand our Object Oriented Model.


  • It is a barrier against change propagation
As implementation of function is limited to our class and we have only given the name of the functions to user along with description of parameters so if we change implementation of function it doesn’t affect the Object Oriented Model.

LIKE US

Popular Posts

My FANS around the WORLD

Flag Counter