Lec 01- Introduction to Object-Oriented Programming
Lec 01- Introduction to Object-Oriented Programming
Lecture 01
Introduction to Object-Oriented Programming in Java
30/04/2024
Bachelor of Science (Hons) in Computer Science | Software Engineering | Information Technology
Department of Computing
Faculty of Computing and Technology
Saegis Campus
Nugegoda
1
Lecturer Name Saegis Campus
Programming Paradigms
• Paradigm can also be termed as method to solve some problem or do some task.
2
Lecturer Name Saegis Campus
Programming Paradigms
3
Lecturer Name Saegis Campus
Importance of Different Paradigms of
Programming
Understanding and using different programming paradigms is important for various reasons:
Problem-solving: Each paradigm offers unique ways to solve problems, enabling you to choose the most suitable
approach for a given task.
Readability and maintainability: Different paradigms promote different code structures, which can improve the
readability and maintainability of your programs.
Flexibility: Knowledge of various paradigms allows you to adapt your programming style and techniques to match the
requirements of a specific project.
Collaboration: Working in teams often requires understanding of different paradigms, as team members might have
different programming backgrounds and preferences.
4
Lecturer Name Saegis Campus
Procedural Programming Paradigm
• Procedural programming is a programming paradigm that focuses on writing code as a sequence of
procedures or functions that are executed in a linear or step-by-step fashion.
• It emphasizes breaking down a problem into smaller, reusable, and self-contained procedures,
making it easier to understand and maintain the code.
5
Lecturer Name Saegis Campus
Functional Programming Paradigm
Functional programming is a programming paradigm that treats computation as the evaluation of mathematical
functions and avoids changing state and mutable data.
6
Lecturer Name Saegis Campus
Object-Oriented Programming
• Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects,"
which can contain data (attributes or properties) and code (methods or functions).
• It aims to organize code into reusable, modular units, making it easier to understand, maintain, and
scale.
7
Lecturer Name Saegis Campus
OOP Concepts
8
Lecturer Name Saegis Campus
Java Classes
• A class is a blueprint or prototype from which objects are created.
• It represents the set of properties or methods that are common to all objects of one type.
Syntax
Class <classname>{
<fields>
<methods>
}
9
Lecturer Name Saegis Campus
Java Object
• Objects are instances of a class.
• An object is a concrete 'thing' that has the properties and actions described by its class.
Syntax
10
Lecturer Name Saegis Campus
Java Class and Object
11
Lecturer Name Saegis Campus
Java class and Object
12
Lecturer Name Saegis Campus
How to represent Object and Behaviors
13
Lecturer Name Saegis Campus
Modeling Class and Creating Objects
14
Lecturer Name Saegis Campus
Questions??
15
Lecturer Name Saegis Campus
16
Lecturer Name Saegis Campus