100% found this document useful (1 vote)
379 views

Jimma Institute of Technology: Chapter 1 Introduction To OOP

This document provides an introduction to object-oriented programming (OOP) concepts. It discusses programming paradigms and lists OOP as one paradigm. The basic OOP concepts of abstraction, encapsulation, inheritance, polymorphism, and data hiding are defined. Examples are provided to illustrate abstraction and encapsulation. Inheritance is described as acquiring properties from a parent class. Polymorphism allows single actions to be performed differently based on data type.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
379 views

Jimma Institute of Technology: Chapter 1 Introduction To OOP

This document provides an introduction to object-oriented programming (OOP) concepts. It discusses programming paradigms and lists OOP as one paradigm. The basic OOP concepts of abstraction, encapsulation, inheritance, polymorphism, and data hiding are defined. Examples are provided to illustrate abstraction and encapsulation. Inheritance is described as acquiring properties from a parent class. Polymorphism allows single actions to be performed differently based on data type.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Jimma university

Jimma institute of technology


Faculty of Electrical and Computer Engineering(FECE)

OBJECT Oriented Programming(ECEg3142)

Chapter 1 Introduction to OOP


By: Sileshi Aweke

10/18/2019 1
Chapter contents
❑ Programming Paradigm and Sorts of Programming
paradigms
❑ Object Oriented Programming
❑ Basic concepts of OOP
❖ Abstraction
❖ Encapsulation
❖ Inheritance
❖ Polymorphism
❖ Data Hiding
❖ Reusability
❖ Extensibility
10/18/2019 2
Programming paradigms

❖ Programming Paradigm:- is a model of programming


based on distinct concepts that shapes the way
programmers design, organize and write programs.

❖ Also defined as a style or way of programming.

❖ Programming Paradigm is not a language by itself,


rather, it is a way to classify programming languages
into different categories based on their designing,
organizing or writing fashion.

10/18/2019 3
Programming paradigms…
❖ Some paradigms are concerned mainly with
implications for the execution model of the language,
such as the sequence of operations is defined by the
execution model.

❖ Other paradigms are concerned mainly with the way


that code is organized, such as grouping a code into
units along with the state that is modified by the
code.

❖ Yet others are concerned mainly with the style of


syntax and grammar.
10/18/2019 4
Programming paradigms…
Why does a programming paradigm matter?
➢ Program size keeps growing quickly leading to more
complexity. So, for a particular purpose choosing an
appropriate programming paradigm helps to manage
complexity of the program.

10/18/2019 5
Programming paradigms…
❖ Currently, there are different sorts of programming
paradigms and the following are some common
Paradigms:

➢ unstructured programming

➢ Structured programming

➢ Modular programming

➢ Logic programming

➢ Procedural programming

➢ Object oriented programming … etc


10/18/2019 6
Programming paradigms…
❖ Unstructured programming:
➢ An earliest programming paradigm with the use of unstructured
control flow; rather it uses labeling and jumping techniques,
such as goto statements or equivalent.
➢ A program in a Unstructured languages uses unstructured jumps to
labels or instruction addresses. The lines are usually numbered or may
have labels: this allows the flow of execution to jump to any line in the
program.

10/18/2019 Fig. Sample code created by using goto statements 7


Programming paradigms…
Structured programming:
A programming paradigm aimed at improving the clarity,
quality, and development time of a computer program by
making extensive use of the structured control flow
constructs of selection (if/elseif / else), repetition
(while,do-while and for),block structures, and subroutines.

10/18/2019 8
Programming paradigms…
❖ Modular programming: is a programming paradigm that
emphasizes separating the functionality of a program into
independent and interchangeable modules or subunits.

❖ In modular programming paradigm, procedures of a common


functionality are grouped together into separate modules.

10/18/2019 9
Programming paradigms…
❖Procedural Programming: is uses a linear or
top-down approach. It relies on procedures or
subroutines to perform computations.

Fig. a) physical structure of procedural programming Fig. b) Depicts the execution process of procedural programming

10/18/2019 10
Programming paradigms…
❖ Logic Programming: a sort of programming which
largely based on formal logic (rules and facts).

❖ Any program written in logic programming is a set of


sentences in a logical form that expressing facts and
rules about some problem domain.

❖ Major logic programming language families include:

➢PROLOG(Program Logic),

➢ ASP(Answer Set Programming),

➢Datalog … etc

10/18/2019 11
Programming paradigms…
Example for logic code sentences:
➢ Rule1: If the food is delicious AND services is
excellent, then the tip is high.

➢ Rule2: If the food is rancid AND services is poor,


then the tip cheap.

Rule3: If the food is food is delicious OR the


services is good, then the tip is medium.

10/18/2019 12
Procedural Vs OOP Paradigm
Procedural Programing
Object Oriented Programming
➢ Emphasis on procedures
❖ Emphasis on object creation
(It is step wise)
data abstraction
➢ Provides less secure
❖ Provides more secure
➢ Difficult to add a new
❖ Easy to add new data and
data and function
function
➢ Follows top-down design
❖ Follows bottom – up design
approach
approach
➢ Example: FORTRAN,COBOL
❖ Example :C++, C#, PHP,Visual
,C, ALGOL..etc
Basic, Java…etc

10/18/2019 13
Introduction to Object Oriented
Programming (OOP)
Object Oriented Programming is one paradigm of
programming, and this programming paradigm is
fundamentally focused on object to design a real
world object into computer programs to solve a given
particular problem. Which means that, Object
oriented programming is a way of organizing
programs as systematic collection of objects, each of
which represents an instance of a class.

10/18/2019 14
Introduction to Object
Oriented Programming(OOP) …

➢ From OOP languages perspective an Object is any


entity with specified states and behaviors. The
object’s states used to describe its identity while
the object’s behaviors used to describe the
performance what the object can do.

10/18/2019 15
Example: If we consider a student as an object, it is possible to mention the following possible
states and behaviors:

Possible states of a Possible behaviors of a


Student: student:
❖ Studying
➢ Name ❖ Learning
➢ Age ❖ Scoring
➢ Gender ❖ Managing …etc
➢ ID …etc

10/18/2019 16
Basic Concepts in OOP
❑ Object oriented programming paradigm model has
its own specific features and these features used to
distinguish it from other programming paradigms.
The basic features or concepts are:
❖ Abstraction
❖ Encapsulation
❖ Inheritance
❖ Polymorphism
❖ Data Hiding
❖ Reusability
10/18/2019 ❖ Extensibility 17
Basic Concepts in OOP …
❖ Abstraction:- is a process of showing only relevant data
and hiding unnecessary details of an object from the
user.
➢ Example1: When you login to your e-mail account as user, you enter
your user_id, password and press login, what happens when you press
login, how the input data sent to e-mail server, how it gets verified is
all abstracted away from you.
➢ Example2: A car in itself is a well-defined object, which is composed
of several other smaller objects like a gearing system, steering
mechanism, engine, which are again have their own subsystems from
the chief Mechanic Perspective. But from the drivers point of view,
car is one single object, which can be managed by the help of its
subsystems, even if their inner details are unknown.
10/18/2019 18
Basic Concepts in OOP…
❖ Encapsulation:- A process of binding and wrapping both
the data and methods for the purpose of protection. So
that, it keeps the entire program safe from external
interference and illegal modification.

10/18/2019 19
Basic Concepts in OOP…
❑Encapsulated code should have the following
characteristics:

o Everyone knows how to access it.

o Can be easily used regardless of implementation


details.

o There shouldn’t any side effects of the code, to the


rest of the application

10/18/2019 20
Basic Concepts in OOP…
❖ Inheritance:- is a mechanism by which an object
acquires certain or all properties of another object.
In doing so, It supports the concept of hierarchical
classification between objects. In OOP paradigm,
the concept of Inheritance applied through Creating
a new class from the existing old class and
inheriting commonly used states and behaviors
from the parent class.

10/18/2019 21
Basic Concepts in OOP…
❖ Polymorphism:- is a technique to process an object
differently based on its data type. which means
that, it allows us to perform a single action method
in different ways. This can be achieved through
method overloading and overriding.
❖ Data Hiding:- is protection mechanism of the
object's data from outsiders object access within
the program. It Implements through
authentication and validation process.
Example: Facebook or e-mail account.
10/18/2019 22
Basic Concepts in OOP…
❖ Reusability:- is a means of reusing formerly developed
program for an other related purpose or project.

❖ Extensibility:-is a mechanism of extending the existing


program without changing its basic architectures. This

technique used to enhances or extends the existing


code functionality through adding extra features in
the existing system.

Both Program Reusability and Extensibility have


an advantage in reduction of cost and program
development time.

10/18/2019 23
END of ch-1
THANK YOU!!!

10/18/2019 24

You might also like