Вы находитесь на странице: 1из 19

INTRODUCTION TO OBJECT ORIENTED PROGRAMMING

SOFTWARE DEVELOPMENT
Software: A software is defined as a collection of programs to do a specific task. The person who is using the software is called end-user. Objectives of software development: I. It must satisfy the end-user. II. Development cost must be minimum. III. It should take minimum amount of development time. IV. It should be reliable V. It should be reusable.

The objectives are

Correctness Maintainability Reusability Openness and interoperability Portability Security Integrity User friendliness

Software evaluation
Object oriented programming
Procedure oriented Assembly language Machine language

Software evaluation

Machine language it uses 0s and 1s for writing programs. It is very difficult to write and correct errors. It is machine dependent. Assembly language it uses symbolic codes for writing programs. It is difficult to write and correct errors. It is machine dependent. Procedure oriented programming it uses high level languages like COBOL,PASCAL and C. We use functions, procedures and different data structures for writing programs. object -oriented programming it uses high level languages like c++, java etc. it has a collection of discrete objects incorporated with data structures and its behaviour.

Procedure oriented programming


Global variable main Local variable

Function-1 Local variable

Function-2
Local variable

Function-3
Local variable

Features: I. Large problems are divided in to smaller problems known as functions or procedures. II. It is top down programming technique. III. Data moves freely from one function to another. IV. Function can share global variables. V. Data hiding is not possible.

Object oriented programming paradigm

The given problem is divided into number of entities called objects. The related functions ,data and its structures are all defined inside the objects. The data inside the objects are called attributes and the related functions are called operations. The data of an object can be accessed only by the function associated with that object. finally all the objects are interfaced to solve the problem.

Consider a problem to design a computer system


This problem is divided into three objects namely I. Monitor II. Keyboard III. CPU Keyboard Monitor
Data . Data . Function ..

Function ..
CPU Data . Function ..

Features Object oriented programming


I.

II.
III. IV. V. VI.

Programs are divided in to objects. It is not possible to access data freely. Data hiding is possible. It is bottom-up programming technique. It is easy to add new data and functions. Objects can exchange data through its function.

Object oriented programming concepts


i. Objects ii. Class iii. Data Abstraction iv. Encapsulation v. Inheritance vi. Polymorphism vii. Dynamic binding viii. Message passing

Objects

Objects are the Basic run time entities. They may represent a person, a place , a bank account that the program has to handle. An instance of a class is called object. We can create any number of objects related to the class. Each object contains data and code to manipulate data. The following fig. shows the two ways to represent objects.

Class

Class is template for an object. It is a collection of objects with same type of data and functions. We can create any number of objects related to the class. Data items in a class are called data members. The functions with in a class is called member functions. (user defined class) example: class name fruit fruit mango , apple , orange;

Data Abstraction& Encapsulation


Data abstraction is defined as a grouping of essential details and ignoring background details. For example cost , size , weight and color are all named collection of data that describes the objects chair in the class furniture. Data Encapsulation is a technique used to hiding the information's(data) in an object from other objects. The wrapping up of data and functions into a single unit is known as encapsulation. Data hiding

Inheritance
Inheritance is the process by which objects of one class obtain the properties of objects of another class. The main advantages of the inheritance are Reusability of the code To increase the reliability of the code To add some enhancement to the base class.

Polymorphism

Polymorphism means one name, multiple forms. It allows us to have more than one function with the same name in a program. Operator overloading and functionoverloading comes under polymorphism. Ex. Draw() is defined in all the classes.

POLYMORPHISM COMPILE TIME POLYMORPHISM OPERATOR OVERLOADING FUNCTION OVERLOADING RUN TIME POLYMORPHISM VIRTUAL FUNCTION

Dynamic binding
Binding is defined as the connection between the functions call and its corresponding program code to be executed . Types: 1. static binding 2. dynamic binding (late binding)

Message passing
Message passing is a process of locating and executing a function in response to a message. Locating means matching the given message with the list of available functions.

Order1.place_order(qty_in_hand);

Advantages of oops

Reliable Less error prone Easy to add new feature Reusability of code

Вам также может понравиться