Docsity

INTRODUCTION TO OOPS, Study notes of Computer science

Toggle sidebar
bg1
CHAPTER 1: Introduction to OOPS
(Object-Oriented Programming System)
Table of Contents
1. Introduction to Programming
2. What is Programming?
3. What is a Programming Paradigm?
4. What is POP (Procedure-Oriented Programming)?
5. Features of POP
6. Advantages of POP
7. Disadvantages of POP
8. What is OOPS?
9. Why was OOPS introduced?
10. Features of OOPS
11. POP vs OOPS
12. Real-Life Examples
13. Why Most Modern Languages Use OOPS
14. Applications of OOPS
15. Advantages of OOPS
16. Disadvantages of OOPS
17. Core Concepts of OOPS
18. OOPS Flow Diagram
19. Summary
20. Interview Questions
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17

Partial preview of the text

Download INTRODUCTION TO OOPS and more Study notes Computer science in PDF only on Docsity!

CHAPTER 1: Introduction to OOPS

(Object-Oriented Programming System)

Table of Contents

  1. Introduction to Programming
  2. What is Programming?
  3. What is a Programming Paradigm?
  4. What is POP (Procedure-Oriented Programming)?
  5. Features of POP
  6. Advantages of POP
  7. Disadvantages of POP
  8. What is OOPS?
  9. Why was OOPS introduced?
  10. Features of OOPS
  11. POP vs OOPS
  12. Real-Life Examples
  13. Why Most Modern Languages Use OOPS
  14. Applications of OOPS
  15. Advantages of OOPS
  16. Disadvantages of OOPS
  17. Core Concepts of OOPS
  18. OOPS Flow Diagram
  19. Summary
  20. Interview Questions

1. Introduction to Programming

Before learning OOPS, we should first understand what programming is.

Imagine this Situation

Suppose you ask your friend,

"Please bring me a glass of water."

Your friend understands your instruction and brings the water.

Similarly,

A computer only understands instructions.

These instructions are called a program.

A person writes these instructions using a programming language like

● Java ● Python ● C ● C++ ● C# ● JavaScript

This process is called Programming.

Definition

Programming is the process of writing instructions for a computer to perform a particular task.

2. What is a Program?

A Program is a collection of instructions that tells the computer what to do.

A Programming Paradigm is a style or method of writing programs.

Think of it as different ways to solve the same problem.

Example

Suppose you want to travel from Chennai to Bangalore.

You can travel by

● Bus ● Train ● Car ● Flight

Your destination is the same.

Only the method changes.

Similarly,

A programming problem can be solved using different programming styles.

These styles are called Programming Paradigms.

Types of Programming Paradigms

1. Procedure-Oriented Programming (POP)

Example Languages

● C

2. Object-Oriented Programming (OOPS)

Example Languages

● Java

● C++

● C#

● Python

3. Functional Programming

Examples

● Haskell ● Scala

4. Logic Programming

Examples

● Prolog

For now, we only focus on

● POP ● OOPS

5. What is POP (Procedure-Oriented

Programming)?

POP stands for

Procedure-Oriented Programming

It is the oldest programming approach.

POP Structure

Program

Input Process Print Exit

(Function)(Function)(Function)(Function)

POP Example

Main()

Input();

Calculate();

Display();

Exit();

}

Everything is divided into functions.

Features of POP

  1. Program is divided into functions.
  2. Functions are more important than data.
  3. Data is shared between functions.
  4. Uses Top-Down approach.
  5. Easy for small programs.
  6. Less secure.
  7. Difficult for large software.

Advantages of POP

1. Easy to Learn

Very easy for beginners.

2. Faster Execution

Small programs execute quickly.

3. Less Memory

Consumes less memory.

4. Easy for Small Projects

Suitable for

● Calculator ● Student Marks

3. No Data Hiding

Anyone can modify data.

4. Code Reusability is Less

The same code is written repeatedly.

5. Maintenance is Difficult

Finding errors becomes difficult.

Example

Suppose a Bank has

Customer Data

Deposit()

Withdraw()

Interest()

Loan()

↓

Balance()

All functions can directly change customer data.

If one function accidentally changes the balance,

Every other function is affected.

This is one of the biggest problems of POP.

6. Why was OOPS Introduced?

As software became larger,

POP started creating many problems.

Examples

● Facebook ● WhatsApp ● Google ● Banking ● Amazon ● Railway Reservation

These applications contain millions of lines of code.

Managing them using only functions became very difficult.

Scientists introduced a better approach called

Objec t

State Behavior

Car Color, Model, Speed

Start, Stop, Brake

Stude nt

Name, Roll No Study, Write Exam

Mobil e

Brand, RAM Call, Message

Fan Speed Rotate

TV Channel Play

OOPS Structure

Program

|

Object1 Object2 Object

Data + Methods

Difference Between POP and OOPS

Thinking

POP

Function

↓

Data

OOPS

Object

Data

Methods

8. Features of OOPS

There are six major features of OOPS:

  1. Object
  2. Class
  3. Encapsulation
  4. Abstraction
  5. Inheritance

Hospital

Registration()

Doctor()

Medicine()

Billing()

Exit()

Only functions are considered.

OOPS Approach

Hospital

Patient Object

Doctor Object

Medicine Object

Staff Object

Bill Object

Each object stores its own data and methods.

This makes the software organized.

11. Why Do Companies Prefer OOPS?

Companies like

● Microsoft ● Google ● Amazon ● Oracle ● IBM ● Infosys ● TCS ● Wipro

prefer OOPS because it helps build large, maintainable, and reusable software.

12. Applications of OOPS

OOPS is used in

● Banking Software ● ATM Machines ● Hospital Management ● College Management ● Railway Reservation ● Airline Reservation ● Mobile Apps

5. Easy Teamwork

Different developers can work on different classes and objects.

6. Real-World Modeling

Matches how we think about real-world entities.

7. Flexible

Easy to add new features.

8. Reduces Code Duplication

The same code doesn't need to be written repeatedly.

14. Disadvantages of OOPS

1. Learning Takes Time

Beginners need time to understand concepts.

2. More Memory

Objects require memory.

3. Slightly Slower

Creating and managing objects adds some overhead.

4. Not Necessary for Very Small Programs

A simple calculator may not need a full OOPS design.

15. OOPS Flow Diagram

Programming

↓

Programming Paradigm

↓

Procedure-Oriented Programming (POP)

Problems

Need Better System

Object-Oriented Programming (OOPS)

Object