Lecture 1- 21-Jan-2025
Lecture 1- 21-Jan-2025
• The other levels were created to make it easier for a human being to
write programs
36
Programming language levels
• Machine language
• Primitive instruction built into each machine
• Each type of CPU has its own language
• Binary based instructions
• => Difficult for humans to read or write.
• Assembly language
• Short English like words for commands and data
• Hardware-specific, as each CPU architecture has its own assembly
language.
• Uses mnemonics (e.g., MOV, ADD, SUB) instead of binary codes.
• Drawback:
• Programs run more slowly,
• as translation occurs during execution
Java Translation and Execution
• The Java compiler translates Java source code into a special
representation called bytecode (javac--------.class)
• Java bytecode is not the machine language for any traditional CPU
42
JAVA translation and execution (cont’d)
JAVA
Source code
JAVA
JAVA compiler bytecode
JAVA Bytecode
interpreter compiler
Machine
code
Program development
• Software tools involved
• Editor: type a program and store in a file
• Translation from high level into executable
form
• That translation may result in errors
• You change the code to fix the problem
• Execute the program and evaluate results
errors errors
• A program will always do what we tell it to do, not what we meant to tell it to do
45
Errors
• A program can have three types of errors
• The compiler will find problems with syntax and other basic issues
(compile-time errors)
• If compile-time errors exist, an executable version of the program is not
created
• Example:
• Lassie is one particular dog whose fur is brown and white
• Example:
• Dog consists of traits shared by all dogs
• (fur color, and ability to bark members of a class).
Object oriented software principles (cont’d)
• Inheritance
• The definition of one class is based on another