20CS09-OOPS THROUGH JAVA
1
Dr.S.Naganjaneyulu
Professor
Department of IT
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING,Mylavaram
Krishna Dist, Andhra Pradesh
Course Educational Objective
2
Course Outcomes
At the end of the course, the student will be able to:
3
4
5
6
OS/Hardware
machine code
C source code
myprog.c
gcc
myprog.exe
Platform Dependent
JVM
bytecode
Java source code
myprog.java
javac
myprog.class
OS/Hardware
Platform Independent
Issues:
7
8
Hierarchy of programming paradigms:
9
Procedure Oriented Programming
10
Examples : COBOL,FORTRAN,PASCAL and C
When we concentrate on the development of functions, very little attention is given to the data that is being used by various functions. Global data is the data that is being shared by all the functions and each function has its own local data as shown in figure.
Procedure Oriented Programming
11
very little attention is given to the data that is being used
by various functions.
The following diagrams shows the example of procedure oriented programming.
functions and each function has its own local data as
shown in the figure.
Characteristics of Procedure-Oriented Programming
12
Procedure Oriented Programming �advantages & disadvantages
13
Software Design Approaches:�Top down vs bottom up:
14
Characteristics of Procedure-Oriented Programming
Object-Oriented Programming
Organization of data and functions in OOP
Data
Functions
Object A
Data
Functions
Object B
Data
Functions
Object C
Communication
Characteristics of Object-Oriented Programming�
Characteristics of Object-Oriented Programming
continue …
Object-Oriented Programming
It is an approach that provides a way of modularizing programs by creating partitioned memory area for both data and functions that can be used as templates for creating copies of such modules on demand. Thus the object is considered to be a partitioned area of computer memory that stores data and set of operations that can access that data.
Basic Concepts of Object-Oriented Programming
Basic Concepts of OOP
When a program is executed, the objects interact by sending messages to one another.
continue …
23
24
Basic Concepts of OOP
Object : CUSTOMER
DATA
AC No.
Name of AC Holder
Address
FUNCTIONS
Deposit
Withdrawal
AC Balance Display
Object : ACCOUNT
DATA
AC No.
AC Balance
Type of Account
FUNCTIONS
Account Balance
continue …
Basic Concepts of OOP
Classes are user-defined data types.
The entire set of data and code of an object can be made a user-defined data type with the help of a class. Objects are variables of the type class. Once a class has been defined, we can create any number of objects belonging to that class. Each object is associated with the data of type class with which they are created.
A class is a collection of objects of similar type.
continue …
Basic Concepts of OOP
continue …
Basic Concepts of OOP
I
continue …
Basic Concepts of OOP
continue …
Basic Concepts of OOP
The attributes wrapped in the classes are called data members and the functions that operate on these data are called methods or member functions.
Since the classes use the concept of data abstraction, they are known as Abstracted Data Types (ADT).
continue …
Basic Concepts of OOP
continue …
Property Inheritance
Bird
Attributes:
Feathers
Lay eggs
Flying Bird
Attributes:
------------
------------
Non-flying Bird
Attributes:
------------
------------
Robin
Attributes:
------------
------------
Swallow
Attributes:
------------
------------
Penguin
Attributes:
------------
------------
Kiwi
Attributes:
------------
------------
Basic Concepts of OOP
(By deriving new class from existing one. The new class will have the combined features of both the classes.)
continue …
Basic Concepts of OOP
continue …
Basic Concepts of OOP
continue …
Basic Concepts of OOP
Binding refers to the linking of a procedure call to the code to be executed in response to the call.
Dynamic binding ( late binding ) means that the code associated with a given procedure call is not known until the time of the call at run-time.
It is associated with polymorphism and inheritance.
continue …
Basic Concepts of OOP
continue …
Basic Concepts of OOP
continue …
Benefits of OOP
Benefits of OOP
continue …