CSE-110
Object Oriented
Programming
Lecture
1
About the 1
Instructor
Md Salah Uddin
Assistant Professor and Head
Department of MCT, DIU
B.Sc. (Hons.) & M.Sc. in Computer Science and Engineering
from East West University and Higher School of Economics,
Moscow,Russia
PhD in Graz University of Technology, Austria
Contact: [email protected] 2
Learning Style
● This course is practice oriented.
● The major onus is upon you
○ My job is to show you the path, your job is
to walk.
○You need to practice a lot.
● Memorization will not help you much.
● Copying code of others:
○ Strictly prohibited.
○Will be severely punished if you are
caught.
3
What is Computer
Programming?
4
Computer Programming
● Computer Programming broadly consists of
two things
○Programming Language
○Algorithm
● Human language
○To communicate between two persons
Communication through human
language
Person Person
1 2
(client) (server) 5
Computer Programming
● Computer Programming broadly consists of two
things
○Programming Language
○Algorithm
● Programming language
○To communicate between human and computer
Communication through programming
language
Comput
Person er
1 (server)
(client) 6
Computer Programming
● SupposeContd.
somehow the computer understands a limited form
of human instructions, which is called Programming
Language.
○ How will be discussed in various courses of your entire degree.
● Is only Programming Language enough for the machine to work
“intelligently”?
○ A machine (computer) cannot do anything by itself. It can
only perform some basic actions prescribed by a human
(programmer).
■ Basic actions: addition, subtraction, compare two numbers
etc.
○ So how to make a machine to perform a particular work as
per the these basic instructions given by a human?
7
Computer Programming
Contd.
● Take an analogy:
○Suppose you (client) want a cup of tea from a person (server).
○You say: “Bring me a cup of tea”.
○ If the person (1) understands your language, (2) knows how to
make a cup of tea and (3) is not handicapped/insane, he will be
able to serve you as per your instruction.
○However, suppose that the requirement No. 2 is absent in the
serving person
i.e. the person doesn‟t know how to make a cup of tea.
○ So in the first place someone needs to train the person as to how to
make a cup of tea. And this is Programming!
■ A programmer trains/teaches a computer as to how to
solve a given problem.
■More specifically, a programmer gives a clearly
specified set of instructions to a computer to solve a
8
particular problem.
Computer Programming
Contd.
● Analogy Contd.
○Now, how to train the person to make a cup of tea?
○Someone (programmer) writes some instructions to the person
as follows:
• Procedure: Making a cup of tea.
Step 1: Take a cup of water.
Step 2: Pour the water into a
kettle. Step 3: Heat the kettle.
Step 4: If the water is boiled, then pour some tea.
Step 5: After 2 minutes, bring the kettle back from
the stove. Step 6: Pour the water into a cup.
Step 7: Pour some sugar and milk into the
water. Step 8: Stir the mixture of the cup
with a spoon. Step 9: Give the cup to the
client.
9
Computer Programming
Contd.
● Now can the person (server) make a cup of tea?
○Yes, but only when the ambiguity present in some of the instructions are
eliminated because a machine is stupid - it can only do something
if it is told to do so.
○The corrected form of the procedure is as follows:
• Procedure: Making a cup of
tea. Step 1: Take a cup
of water.
Step 2: Pour the water into a
kettle. Step 3: Heat the kettle.
Step 4: If the water is boiled, then pour 1 spoon of tea.
Step 5: After 2 minutes, bring the kettle back from
the stove. Step 6: Pour the water into a cup.
Step 7: Pour 1 spoon of sugar and 3 spoon of milk into
the water. Step 8: Stir the mixture of the cup with a
spoon for 30 seconds. Step 9: Give the cup to the client.
10
○This type of a set of clearly specified instructions to solve a particular
Computer Programming
Contd.
● Now from the perspective of a machine.
○ A machine understands a programming language. (how is not part
of this course). No. 1 requirement of slide 12 is fulfilled.
○ A machine can do some basic operations (add, subtract,
multiplication, division, comparison, taking input from keyboard,
printing output to the screen, storing in and retrieving results
from computer memory etc.) No. 3 requirement of slide 12 is
fulfilled.
○ The only thing is to fulfill requirement No. 2 of slide 12 i.e. to
train the machine to solve a particular problem. ○ Example: next
slide…
11
Computer Programming
● SupposeContd.
we want a machine to perform addition, subtraction,
multiplication and division of two numbers. (A simple calculator)
● Procedure: A simple Calculator A machine can take a
Step 1: number and sign but it
Take a number. will not take unless it is
Step 2: Take a sign (+, -, * or /). instructed.
Step 3:4: Take
If theanother number.
sign is „+‟, then add the two numbers and store
the result. Step 5: If the sign is „-‟, then subtract the two
numbers and store the result. Step 6: If the sign is „*‟, then
multiply the two numbers and store the result. Step 7: If the sign
is „/‟, then divide the two numbers and store the result.
Step 8: Display the result.
A machine can add two numbers
but
it will not add unless it is 12
Java Compilation Process
Java Compilation Process
Java Compilation Process
Java Compilation Process
Steps in the Java Compilation
Process
Steps in the Java Compilation
Process
Steps in the Java Compilation
Process
Diagram of the Java Compilation
Process Java Source Code (.java)
↓
Java Compiler (javac)
↓
Bytecode (.class)
↓
Class Loader (JVM)
↓
Bytecode Verifier (JVM)
↓
Execution by JVM (or JIT Compiler)
↓
Program Output
Java Virtual Machine
Java Runtime Environment
Jave Development Kit
Summary of the Lecture: Object-Oriented
Programming (OOP)
Summary of the Lecture: Object-Oriented
Programming (OOP)
Summary of the Lecture: Object-Oriented
Programming (OOP)
Summary of the Lecture: Object-Oriented
Programming (OOP)
Summary of the Lecture: Object-Oriented
Programming (OOP)
Summary of the Lecture: Object-Oriented
Programming (OOP)
Summary of the Lecture: Object-Oriented
Programming (OOP)
Questions?
61