Showing posts with label OOP. Show all posts
Showing posts with label OOP. Show all posts

Tuesday, 28 November 2017

what is Object Oriented Programming

OOP is a technique to develop logical modules, such as classes that contains properties, fields and events. Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. It simplifies the software development and maintenance by providing some concepts:
  • Object
  • Class
  • Inheritance
  • Polymorphism
  • Abstraction
  • Encapsulation
Simula is considered as the first object-oriented programming language.

What is Class

Class is basic building block of OOP. A class contains data and behavior of entity.

What is an Object?

Object is an instance of a class. Any entity that has state and behavior is known as an object.
For example: chair, pen, table, keyboard, bike etc. It can be physical and logical. An object has three characteristics:
  • State:- represents data (value)of an object.
  • behavior(functionality):-represents the functionality of an object.
  • identity:-object identity is typically implemented via a unique ID. The value of the ID is not visible to the external user. But it is used internally by the compiler to identify each object uniquely.
For example "keyboard" is an object .Its name dell color black know as its state. It is used for typing so, typing is it behavior.
Class is a template or blueprint from which object are created.  So object is the instance of a class.

Difference between Procedure/structure oriented programming and object oriented programming

Procedure/ structure oriented Programming

 Conventional programming, using high level languages such as COBOL, FORTRAN and C, is

commonly known as procedure-oriented programming (POP).

 In the procedure-oriented approach, the problem is viewed as a sequence of things to be done

such as reading, calculating and printing. A number of functions are written to accomplish these

tasks.

 The primary focus is on functions.



Object Oriented Programming

 Emphasis is on data rather than procedure.

 Programs are divided into what are known as objects.

 Data is hidden and cannot be accessed by external functions.

 Objects may communicate with each other through functions.

 New data and functions can be easily added whenever necessary.