0% found this document useful (0 votes)
53 views

Week 3 Lecture 1 Objects

This document discusses object-oriented programming concepts. It defines objects, their attributes and behaviors. It provides examples of tangible objects like people and cars and intangible objects like time and date. It explains that an object-oriented model uses interacting objects to represent a real-world scenario or problem. Object-oriented programming maps real world problems to programming languages using objects and their relationships.

Uploaded by

Mahad Elahi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Week 3 Lecture 1 Objects

This document discusses object-oriented programming concepts. It defines objects, their attributes and behaviors. It provides examples of tangible objects like people and cars and intangible objects like time and date. It explains that an object-oriented model uses interacting objects to represent a real-world scenario or problem. Object-oriented programming maps real world problems to programming languages using objects and their relationships.

Uploaded by

Mahad Elahi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Mr.

Daniyal A h m e d
Lecture 5
Today’s Agenda

 Comparison of OOP and Procedural Approach


 What is Object Orientation?
 What is a model?
 What is OO model?
 Examples of OO model
 Introduction to Objects
 Tangible Objects
 Intangible Objects
Real Word Scenario
Real Word Scenario
Scenario 1
Real Word Scenario
Scenario 2
Real Word Scenario
Scenario 3
What is Object-Orientation?
 It is a technique in which we visualize our programming
problems in the form of objects and their interactions as
happens in real life.

 In object orientation we move our concentration to objects


in contrast to procedural paradigm in which we simply write
our code in functions and call them in our main program.

 It is a technique used for system modeling.

 OO model consists of several interacting objects.


What is Object-Orientation?
Examples:
W e h a v e d iffe re n t o b je cts a ro u n d u s in o u r re a l life th a t in te ra ct w ith ea c h o th e r to
p e rfo rm d iffe re n t o p e ra tio n s fo r e x a m p le ,

A Person A House

A Tree A Car

Different Objects
What is Object-Orientation?
These objects interact with each other to perform different operations,

Lives in
ALI HOUSE

Drives

CAR TREE
What is a model?
 A model is an abstraction of something real or conceptual.

 We need models to understand an aspect of reality.

Model Examples

Highway maps

Architectural models

Mechanical models
 
What is OO model?

 In the context of programming, OO models are used to


understand the problem before starting developing it.

 We make Object Oriented models showing several interacting


objects to understand a system given to us for implementation.

 OO model helps us to visualize and understand a real life


situation along-with its behavior.
Example of OO model?
Example of OO model
Advantages of OO modeling Approach
Object Oriented Programming
What is an Object?

An object is,
 
 Something tangible (Ali, School, House, Car).
 Something conceptual (that can be apprehended
intellectually for example time, date and so on…).
 
An object has,
 
 State (attributes)
 Well-defined behavior (operations)
 Unique identity
What is an Object?
Example of Tangible Objects:

Ali is a tangible object, having some characteristics (attributes) and


behavior as given below,

Ali

Characteristics (attributes) Behavior (operations)

• Name • Walks
• Age • Eats

Unique Identity: Name


What is an Object?
Example of Tangible Objects:
Car is also a tangible object having some characteristics (attributes) and
behavior given below,

• Car
• State (attributes) • Behavior (operations)

• Color Model • Accelerate Start Car


• Change Gear

Unique Identity: Car Registration Number


What is an Object?
Example of Intangible Objects:

Time is an intangible (conceptual) object

Time
State (attributes) Behavior (operations)

• Hours Seconds • Set/Get Hours


• Minutes • Set/Get Seconds
• Set/Get Minutes

Unique Identity: Unique ID for Time Objects


What is an Object?
Example of Intangible Objects:

Date is also an intangible (conceptual) object

State (attributes) Behavior (operations)


Year Set/Get Year
Day Set/Get Day
Month Set/Get Month

Unique Identity: Unique ID for Date Objects


Summary
• Model is the abstraction of some real word scenario. It helps us to understand
that scenario.
• Object oriented model of any scenario (problem) describes that scenario
(problem) in the form of interacting objects.
• We use Object Orientation because it helps us in mapping real world problem in a
programming language.
• Object Orientation is achieved using objects and their relationships.
• Properties of an object are described using its data members and behavior of an
object is described using its functions.
• Objects may be tangible (physical) or intangible (also called conceptual or virtual).
• Generally when we have given a certain problem description, nouns in that
problem description are candidates for becoming objects of our system.
• There may be more than one aspects of an object
• It is not necessary that every object has a specific role in implementation of a
problem there may be some objects without any role, like school parking in our
school.
• It is easier to develop programs using Object Oriented Programming because it is
closer to real life.

You might also like