Lecture 1
Lecture 1
What is a Computer?
A computer is a machine that performs calculations and
processes information.
● Hardware refers to the electronic and mechanical components
of a computer
● Software refers to the programs that control the hardware.
Software
There are two types of software:
● Application software – provide particular task or
service. Ex: word processors, computer games,
spreadsheet programs, Web browsers...
● System software – programs that include basic
operations that make a computer usable. Ex:
operating system, which includes drivers,
protocols,...
Why Study Programming?
Programming Languages
Programming Languages2
● In addition, highlevel languages use symbols and notations,
understandable by humans.
● For example, arithmetics operations in Java make use of
familiar operations such as “+”, “”, “*”, “/”, so that
arithmetic expressions look like those in algebra.
● Ex: to calculate average of 2 numbers, you might use the
expression: (a + b) / 2
Programming language > machine language > CPU or
microprocessor > result.
● Macintosh has PowerPC chip, Windows has Pentium chip, so...
platform dependent.
Programming language3
● In general, machine languages are based on binary codes,
a twovalue system that is well suited for electronic
devices.
● In binary system everything is considered in terms of 1's
and 0's which closely corresponds to “on” and “off”
states of transistors.
● For example, in binary code, the number 13 would be
represented as 1101. Similarly, a particular address in
the computer's memory might be represented as
01100011, and an instruction in the computer's
instruction set might be represented as 001100.
PL4(translators)
Source code translators come in two varieties:
● Interpreter – translates line by line
● Compiler – translates entire source code
Why Java?
Features
1. Java is objectoriented
● Object-oriented languages divide programs into separate modules,
called objects, that encapsulate the program's data and
operations.
2. Java is robust
● meaning that errors in Java programs don't cause system crashes
as often as errors in other programming languages. Certain
features of the language enable many potential errors to be
detected before a program is run.
Features2
3. Java is platformindependent
● A platform, in this context, is just a particular kind of computer
system, such as a Macintosh or Windows system. Java's
trademark is "Write once, run anywhere." This means that a
Java program can be run without changes on different kinds of
computers.
4. Java is secure language
● Designed to be used on networks, Java contains features that
protect against untrusted code, code that might introduce a virus
or corrupt your system in some way
Exercise 1: Explain the difference between each of the
following pairs of concepts.
✔ hardware and software
✔ systems software and application software
✔ compiler and interpreter
✔ machine language and highlevel language
✔ source code and byte code
✔ Oak and Java
✔ COBOL and FORTRAN
Thank you!