Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Object Oriented Programming for Computer science and Engineering students

Rating
-
Sold
-
Pages
289
Uploaded on
30-01-2024
Written in
2023/2024

Object-Oriented Programming (OOP) is a programming paradigm that organizes code into reusable, self-contained units called objects. Objects represent real-world entities and encapsulate data (attributes) and behavior (methods) related to those entities. Key principles of OOP include encapsulation, inheritance, and polymorphism. Encapsulation involves bundling data and methods within a class to restrict access and ensure data integrity. Inheritance allows the creation of new classes based on existing ones, promoting code reuse. Polymorphism enables objects to take on multiple forms, allowing flexibility in code design. OOP fosters modular and maintainable code, making it a widely adopted paradigm in software development.

Show more Read less
Institution
Course

Content preview

UNIT 1 INTORDUCTION TO OOP AND JAVA

Overview of OOP – Object Oriented Programming Paradigms – Features of Object Oriented
Programming – Java Buzzwords – Overview of Java – Data Types, Variables and Arrays –
Operators – Control Statements – Programming Structures in Java – Defining Classes in Java –
Constructors – Methods – Access Specifiers – Static Members
– JavaDoc Comments.

: Overview of OOP


 OBJECT ORIENTED PROGRAMMING (OOP):

Object-Oriented Programming System (OOPs) is a programming paradigm based onthe
concept of ―objects that contain data and methods, instead of just functions and procedures.

✓ The primary purpose of object-oriented programming is to increase the flexibility and
maintainability of programs.
✓ Object oriented programming brings together data and its behavior (methods) into a
single entity (object) which makes it easier to understand how a program works.




• Features / advantages of Object Oriented Programming :-
1. It emphasis in own data rather than procedure.
2. It is based on the principles of inheritance, polymorphism, encapsulation and
dataabstraction.
3. Programs are divided into objects.
4. Data and the functions are wrapped into a single unit called class so thatdata ishidden
and is safe from accidental alternation.
5. Objects communicate with each other through functions.
6. New data and functions can be easily added whenever necessary.
7. Employs bottom-up approach in program design.

, PROCEDURE-ORIENTED PROGRAMMING [POP]:
Procedure-Oriented Programming is a conventional programming which consists of writing a
list of instructions for the computer to follow and organizing these instructions into groups
known as Functions (or) Procedures (or) subroutines (or)Modules.

Example: A program may involve the following operations:
✓ Collecting data from user (Reading)
✓ Calculations on collected data (Calculation)
✓ Displaying the result to the user (Printing)


Main Program
Global Data




Procedure
Procedure Procedure
3(Printing)
1(Reading) 2(Calculation)
Local Data Local Data
Local Data




Characteristics of Procedural oriented programming:-
1. It focuses on process rather than data.
2. It takes a problem as a sequence of things to be done such as reading, calculating and
printing. Hence, a number of functions are written to solve a problem.
3. A program is divided into a number of functions and each function has clearly defined
purpose.
4. Most of the functions share global data.
5. Data moves openly around the system from function to function.
6. Employs top-down approach in program design.

Drawback of POP
➢ Procedural languages are difficult to relate with the real world objects.
➢ Procedural codes are very difficult to maintain, if the code grows larger.
➢ Procedural languages do not have automatic memory management as like in Java. Hence, it
makes the programmer to concern more about the memory management of the program.
➢ The data, which is used in procedural languages, are exposed
program.So, there is no security for the data.
➢ Examples of Procedural languages :
o BASIC
o C
o Pascal
o FORTRAN

, Difference between POP and OOP:


Procedure Oriented
Object Oriented Programming
Programming
Divided Into In POP, program is divided into In OOP, program is divided into
smallparts called functions. partscalled objects.
In POP, Importance is not givento In OOP, Importance is given to the data
Importance data but to functions as well rather than procedures or functions
as sequence of actions to bedone. because it works as a
real world.
Approach POP follows Top Down OOP follows Bottom Up
approach. approach.
Access Specifiers POP does not have any OOP has access specifiers named
accessspecifier. Public, Private,
Protected, etc.
In POP, Data can move freely In OOP, objects can move and
Data Moving fromfunction to function in the communicate with each other
system. throughmember functions.
Expansion To add new data and functionin OOP provides an easy way toadd
POPis not so easy. newdata and function.
In POP, Most function uses Global In OOP, data cannot move easily from
Data Access data for sharing that can be accessed function to function, it can be kept
freely from function to function in public or private so we can control the
the access of data.
system.
Data Hiding POP does not have any OOP provides Data Hiding so
proper wayfor hiding data so it provides more security.
is less secure.
In POP, Overloading is not In OOP, overloading is possible in the
Overloading possible. form of Function Overloading and
Operator Overloading.
Examples Examples of POP are: C,VB, Examples of OOP are: C++, JAVA,
FORTRAN, and Pascal. VB.NET, C#.NET.

, : FEATURES / CHARACHTERISTICS OF OBJECT ORIENTED
PROGRAMMINGCONCEPTS

OOPs simplify the software development and maintenance by providing some concepts:

1. Class - Blue print of Object
2. Object - Instance of class
3. Encapsulation - Protecting our data
4. Polymorphism - Different behaviors at different instances
5. Abstraction - Hiding irrelevant data
6. Inheritance - An object acquiring the property of another object

1. Class:
A class is a collection of similar objects and it contains data and methods that operate on
that data. In other words ― Class is a blueprint or template for a set of objects that share a
common structure and a common behavior. It is a logical entity.
A class in Java can contain:
➢ fields
➢ methods
➢ constructors
➢ blocks
➢ nested class and interface

Syntax to declare a class:
Example:
class <class_name>
{
field;
method;
}




2. Object:
Any entity that has state and behavior is known as an object. Object is an instance ofa class.
✓ For example: chair, pen, table, keyboard, bike etc. It can be physical and logical.
✓ The object of a class can be created by using the new keyword in Java
Programminglanguage.

Written for

Institution
Course

Document information

Uploaded on
January 30, 2024
Number of pages
289
Written in
2023/2024
Type
Class notes
Professor(s)
Revathi
Contains
Computer science and engineering

Subjects

$8.89
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
techfighter750

Get to know the seller

Seller avatar
techfighter750 Anna University Chennai
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions