Introduction into
Object Oriented
Programming
Chapter 1
Faculty of Information Technology
Agenda
Structured Programming
Object-Oriented Programming
Why Object-Oriented Programming
Object-Oriented Programming Features
Course Syllabus
12/10/2023 Introduction to OOP 2
What is Structured Programming
• The structured programming allows
developing a program using a set
of modules or functions
• The object-oriented
programming allows constructing a
program using a set of objects and their
interactions
12/10/2023 PRESENTATION TITLE 3
What is Object Oriented Programming
• A class is the blueprint or template for its objects.
• Described through Name, Attributes and Methods.
• Objects are instances of a class.
• Each object has state, behavior and identity.
• You send messages to an object by making method calls
12/10/2023 Introduction to OOP 4
Class Examples
12/10/2023 Introduction to OOP 5
Why Object-
Oriented
Programming ?
Question and Answer !
Object Oriented Programming
Features
1 - Encapsulation: (Hiding Information , Wrapper)
• You don’t allow data to flow freely in your system.
• Wrap data and functions into single unit Class.
• The reason for encapsulation:
• Putting restrcitions so components of an object are not accessed easily.
• Binding data with method.
• Promoting security.
• We will implement this thorugh getters and setters.
• Data protection : public, private, protected.
12/10/2023 PRESENTATION TITLE 7
Object Oriented Programming
Features
2 - Abstraction: (Isolation)
• Show essential features and hide details of implmentation in
background.
12/10/2023 Introduction to OOP 8
Object Oriented Programming
3 - Inheritance: (Reuse)
Features
• When one object requires the properties (attributes and methods) of another
object.
• The reason for inheritance:
• To avoid code duplication. Then easier to add extra attributes/methods
le s? Parent Class
mp
e e xa
r
Mo
Child Class
12/10/2023 PRESENTATION TITLE 9
Object Oriented Programming
Features
4 - Polymorphism (Different Behaviour)
• It means one name with different forms.
12/10/2023 PRESENTATION TITLE 10
Example Create Class Student
Public class student
{ Where is the Object here ?
public String name;
public int year;
What is missing here ?
Public void printHello()
{
System.out.println(“Hello Student ”+ name );
}
12/10/2023
}
Can you think of Class Car ?
PRESENTATION TITLE 11
Let’s go through
syllabus
16 Studying Weeks
3 Quizzes
1 Mid Exam
1 Final Exam
Bad programmers worry about the
code. Good programmers worry
about data structures and their
”
relationships.
Linus Torvalds
12/10/2023 Introduction to OOP 13
Thank you
This material was prepared from the Book:
Interactive Object-Oriented Programming in
Java- 2nd Edition
Vaskaran Sarcar