Lecture_1-Introduction of OOP
Lecture_1-Introduction of OOP
Programming
• Why OOP?
2
Structured Language
and
Object-oriented Language
3
Structured / Procedure
Programming Methodology (SPM)
4
Basic features of SPM
• Emphasis on doing algorithms.
• Large Programs are divided into smaller programs known as
Functions
• Most of the function shares global data.
• Data move around the system globally from function to
function.
• Function transfers the data from one form to another.
• Employs top-down approach of Programming.
6
OOP - Breaking the Barriers of SPM
7
Key Points
• Took the best ideas of SPM and combine with several new
concepts.
• Combine into a single unit both data and the functions that
operate on that data.
• You can’t access the data directly.
• The data is hidden, so it is safe from accidental alteration.
• Data encapsulation and data hiding are key terms in the
description of object-oriented languages.
8
The striking features of OOP
9
Concepts of OOP
• Object
• Class
• Methods
• Instance Variables (Properties)
10
1. Object
• Real world entity.
• Bundle of related variables and functions (also known
methods).
• Objects share two characteristics:
1. Properties / State
2. Method / Behavior (Functionalities)
11
Two characteristics of Object
• Objects share two characteristics:
1. Properties / State
» State is a well-defined condition of an item.
» A state captures the relevant aspects of an object
13
Try?
Object: Car
States(Properties): ?
Behaviors(Functions): ?
14
Try?
Object: Car
15
Try?
Object: ?
States(Properties): ?
Behaviors(Functions): ?
16
2. Class
20
What is Object Oriented Analysis?
Account
Account
Holder
Monthly
Transaction
Banking Software
Branch
Employee
Problem Domain
Objects
Noun Phrase
21
Have a try
?
?
?
University
?
?
Problem Domain
Objects
22
SelfWork
?
?
?
? ?
?
23
Detailing Objects
Account
Bank Holder
Account Holder
Account Has: name, contact
no, accounts
Branch Account
25
Objects are inter-connected
Account Holder
Account
Has: name, contact
Branch no, accounts
Has : Number,
Has: Name, Balance, Opening
Location, Date. Account
No of accounts Holder
Employee
Does: Create new Does:
accounts Deposit given
Has: name, id,
amount
email,
Withdraw given
salary
amount
Does: Handle
banking transactions
26
Detail objects of University
and Find their inter-connection
?
?
?
University
?
?
27
Thank you!
28