0% found this document useful (0 votes)
10 views34 pages

Week 2 Procedural Vs OOP

Uploaded by

jiexfg
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)
10 views34 pages

Week 2 Procedural Vs OOP

Uploaded by

jiexfg
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/ 34

IT PF-01

Object-Oriented
Programming
Apple Grace G. Oliveros
Nueva Ecija University of Science and Technology
UNIT 1
PROCEDURAL vs OBJECT-
ORIENTED
PROGRAMMING
Objectives:
At the end of the discussion, I shall be able
to,

1. Differentiate Procedural and Object-


oriented programming;
2. Describe the background of Java as a
programming language;
3. Define class, objects, methods, attributes
and instances.
PROCEDURAL vs OBJECT-
ORIENTED
Both Procedural Oriented Programming (POP) and
Object Oriented Programming (OOP) are the high
level languages in programming world and are widely
used in development of applications.
Definition
Object-oriented Procedural Oriented
Programming is a Programming is a
programming language programming language that
follows a step-by-step
that uses classes and approach to break down a
objects to create task into a collection of
models based on the variables and routines (or
real world environment. subroutines) through a
sequence of instructions.
Approach

In OOPs concept of objects On other hand in case of


and classes is introduced POP the main program is
and hence the program is divided into small parts
divided into small chunks based on the functions and
called objects which are is treated as separate
instances of classes. program for individual
smaller program.
Access Modifiers

In OOPs access modifiers are On other hand no such


introduced namely as modifiers are introduced in
Private, Public, and POP.
Protected.
Security

Due to abstraction in OOPs On other hand POP is less


data hiding is possible and secure as compare to OOPs.
hence it is more secure than
POP.
Complexity

OOPs due to modularity in On other hand there’s no


its programs is less simple process to add data
complex and hence new in POP at least not without
data objects can be revising the whole program.
created easily from
existing objects making
object-oriented programs
easy to modify.
Examples
Procedural Object-oriented
Programming Programming
int x = 5;
String message = “Welcome to
int y = 7;
Java!”;
int a = x+y;
System.out.println(message);
if (a > 10){
String result =
System.out.println(“Greater
message.toUpperCase();
than 10”);
System.out.println(result);
}

Output:
Output:
Welcome to Java!
Greater than 10
WELCOME TO JAVA!
Java as Object-oriented
Programming
• Java was first introduced by Sun
Microsystems and was further acquired by
Oracle in 1995.
• It’s first name was Oak.
• It was immediately collaborated with Netscape
Navigator’s Java Virtual Machine (JVM)
• Java adapted the syntax of c++
• It promised Write Once, Run Anywhere
(WORA), providing no cost run-times on
popular platforms.
Java as Object-oriented
Programming
• Java as object oriented programming language;
program can be defined as a collection of
objects that communicate via invoking each
other's methods.
Java as Object-oriented
Programming

• Class - A class can be defined as a template/blue print that


describes the behaviors/states that object of its type
support.
• Object - An object represents an entity in the real world
that can be distinctly identified. Objects have states and
behaviors.
• Methods - A method is basically a behavior.
• Attribute - A characteristic/s that describes an object.
• Instance Variables - Each object has its unique set of
instance variables.
Java as Object-oriented
Programming
Java as Object-oriented
Programming
Class:
Dog

Object: Object: Object:


Poodle Shih Tzu AsPin
Method Can Can Can
Bark Bark Bark
Attributes
Name Ginger Bowser Roxy
Age 2 3 1
Shot Up to Delayed Up to
date date
Java installation
What are tools needed?
Desktop & Laptop
• Linux or Windows Operating System
• Java JDK 6 or Higher version
• Notepad or any text editor

Android phone / IOS


• Any Java Compiler App
Essential Tools in Java
Programming

For PC users;
1. Linux/ Windows/ Mac
Operating System
2. Java JDK 6 or higher
versions
https://www.oracle.com/ph/java/t
echnologies/javase-
downloads.html
3. Any text editor
Setting up the path for windows
1.In Search,
Windows search
10 and for and
Windows 8 then select: System
(Control Panel)

2.Click the Advanced system settings link.

3.Click Environment Variables. In the section System


Variables, find the PATH environment variable and
select it. Click Edit. If the PATH environment variable
does not exist, click New.

4.In the Edit System Variable (or New System


Variable) window, specify the value of
the PATH environment variable. Click OK. Close all
remaining windows by clicking OK.

5.Reopen Command prompt window, and run your java


End of Discussion
Questioning
1. it is collection or group of
objects that shares common
attributes.
2. What do you call the
programming approach that
follows one step after the
other?
3. Company first introduced
Java programming?
4. Java follows the syntax of
_____.
5. The first name of java
_____.
6. A characteristic/s that
describes an object.
7. The behavior of an object
is _____.
8. A characteristic/s that
describes an object.
9. Give me at least 3 Object
of A Class Shoes
10. Give me at least 3
attributes of a class SHOES
Thank you!
Laboratory Time
(Facebook Group Chat)

You might also like