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

Lec 01- Introduction to Object-Oriented Programming

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
0% found this document useful (0 votes)
22 views

Lec 01- Introduction to Object-Oriented Programming

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/ 16

CS SE 1209 & IT 1210

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.

• Programming paradigm is an approach to solve problem using some programming


language or also we can say it is a method to solve a problem using tools and
techniques that are available to us following some approach.

• (Programming paradigms are the fundamental styles or approaches to writing


computer programs. They dictate the structure, organization, and methodology of
programming.)

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.

• Object-oriented programming has several advantages over procedural programming:

✓ OOP is faster and easier to execute


✓ OOP provides a clear structure for the programs
✓ OOP helps to keep the Java code DRY "Don't Repeat Yourself", and makes the code easier to
maintain, modify and debug
✓ OOP makes it possible to create full reusable applications with less code and shorter
development time

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.

• So the class describes what an object is like.

• An object is a concrete 'thing' that has the properties and actions described by its class.

• Objects represents the real life entities.

Syntax

Classname refvariable = new Classname();

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

You might also like