Vietnam National University of HCMC
International University
School of Computer Science and Engineering
Object Oriented Programming
Computer Program & Java
Application
Instructor: Le Thi Ngoc Hanh, Ph.D
ltnhanh@[Link]
Semester – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Outline
Java
Computer
Execution
Program
Model
OOP
Java
Through
matters
Process
Slide 2 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
What is a Computer?
A Computer Is a Deterministic Machine
CPU: executes instructions
Memory: stores data & programs
Input / Output: interaction with the world
Slide 3 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Computer Program?
Computer Programming:
Writing instructions for a computer
Instructions must be: Precise, Unambiguous, Ordered
Slide 4 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
What Is a Programming Language
Programming Languages:
Bridge between humans and machines
Levels:
▪ Low-level (close to hardware)
▪ High-level (human-friendly)
Slide 5 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
How Programs Are Executed
Source Compiler
Execution Result
Data
Source
Interpreter Result
Data
Slide 6 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Compiler vs Interpreter
Slide 7 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Java’s Execution Model
Java uses a hybrid execution model.
Steps in Java Compilation:
▪ Source code (.java)
▪ Compiler (javac): converts .java files to Bytecode (.class)
▪ JVM (Java Virtual Machine): Executes Bytecode on any
platform.
Bytecode: Intermediate, platform-independent
format.
JVM: Converts Bytecode into machine
code specific to the host system.
Slide 8 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Why Java for OOP?
Javais designed to strongly support Object-
Oriented Programming
Java was created with OOP as its core paradigm,
not as an add-on. Its language design and runtime
environment actively encourage good OOP
practices.
Slide 9 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Structure of a Java Program
Basic Java Program:
- Class
- main method
- Entry point
Slide 10 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
More example
Slide 11 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Simple Java Program
Slide 12 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Java Data Types
Java is a strongly typed language: Every variable in
Java must have: a type, a name, a value.
Slide 13 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Pass-by-Value vs Pass-by-Reference
Pass-by-Value (Reference Types / Objects)
Java always passes arguments by value
▪ For objects: the value passed is a copy of the reference
▪ Both variables refer to the same object in memory
▪ Modifying the object’s state inside a method: Affects the original object
▪ Reassigning the parameter: Does NOT affect the caller’s reference
Slide 14 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
More Example
Slide 15 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
More Example
Slide 16 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Object Types
Object is the root It is defined in the
(parent) class of package
all Java classes [Link]
Every Java class Unless it explicitly
implicitly extends extends another
Object class
Example:
Slide 17 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Object – Oriented Design
A robust object model is not accidental
Good OO design starts with problem
understanding
Design is iterative, not one-shot
Early designs are expected to change
Slide 18 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Structured vs Object-Oriented Design
Slide 19 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Object-Oriented Though Process
Knowing the difference between the interface and
the implementation.
Thinking more abstractly.
Giving the user the minimal interface possible .
Poor OO design usually violates one or
more of them!
Slide 20 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Interface vs Implementation
Interface
▪ What the user needs to know
▪ What services are provided
Implementation
▪ How the service is carried out
▪ Hidden internal details
Users depend on interfaces, not implementations
Slide 21 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Interface vs Implementation
Slide 22 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
More Examples
Slide 23 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Changing [Implementation vs Interface]
Changing implementation:
▪ Should NOT affect users
Changing interface:
▪ Likely breaks user code
Interchangeable implementations must
behave identically at the interface level
Slide 24 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
End users vs Programmers
▪ End users see GUI-users of an application
▪ Programmers see class interface-users of classes
Slide 25 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
The Implementation
The interface should expose services, not details
Theinterface should NOT include: Internal data
structures, Helper methods, Algorithmic steps
Implementation details must be hidden from
users
Slide 26 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
The interface specification
Slide 27 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Interface/Implementation example
Slide 28 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Separation of interfaces from implementation
+ User code: Calls methods
Depends only on the interface
+ Interface:
Defines the contract
+ Implementation:
Does the real work
Slide 29 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Usefulness, reusability and levels of
abstraction
In OOP, classes can be reused.
Reusable classes tend to have interfaces more
abstract then concrete.
Highly abstract interface are often more useful
than highly concrete interface, but not always the
case.
It is possible to have a very useful.
Slide 30 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Design Goal
To achieve abstract, highly reusable classes:
▪ Focus on what users need to do
▪ Avoid exposing how things are done
User interfaces should:
▪ Be stable over time
▪ Change less frequently than implementations
A well-designed interface:
▪ Supports multiple implementations
▪ Minimizes impact of future changes
Slide 31 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Abstract vs concrete interface
Slide 32 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Minimal interface possible
Provide as little knowledge of the inner workings of as possible
Give only what users need. Better to have to add than to give more than
needed.
Starting from private interfaces
Design from a user’s perspective (not from information systems
viewpoint)
Design a class from requirements
Design with users of the class
Slide 33 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Abstraction & Minimal Interface
Abstract interfaces are often more reusable
Describe what, not how
Provide the minimal interface possible
Better to add later than expose too much early
Slide 34 PPL – Spring 2026
VNU-HCM International University School of Computer Science and Engineering
Determining the users
Next lecture ….
Slide 35 PPL – Spring 2026