Vous êtes sur la page 1sur 24

HSIT 2130

Fundamentals of Programming


By
Budditha Hettige
Department of Statistics and Computer Science
1
Overview
Is Machine can solve problems?
How Problem Solve by machine?
What is Programming?
What are Programming Languages
Compilers
Tools and Tips for Programming
About Programming IDEs



2
Is machine can solve problems?
Caf Machine can be used to make a
Tea
ATM machine use to money transaction
Calculator can be used to solve
equation
Each Machine has
Input
Output
Do some process



3
Caf Machine
Input
Sugar
Water
Tea
Output
Tea
Process
????
Input
Output
Process
4
Calculator
Input
???
Output
???
Process
???

5
ATM machine
Input
???
Output
???
Process
???

6
Process of a Machine
Work through the instructions given to it
Read
Write
Do some Calculation
Goto other instraction
The sequence of instructions is call
Program


7
What is a Programming?
Programming is the way to give
instructions
Each Program has
Start
Do some work
End
Program is given through the machine
understood language
8
What is Computer?
Is a machine that can solve problems
for people by carrying out instructions
given to it
The sequence of instructions is call
Program
The language machine can understand
is call machine language
9
What is Machine Language?
Machine language(ML) is a system of
instructions and data executed directly by a
computer's Central Processing Unit
The codes are strings of 0s and 1s, or binary digits
(bits)
Instructions typically use some bits to represent
Operations (addition )
Operands or
Location of the next instruction.

10
Machine Language contd..
Advantages
Machine can directly access (Electronic
circuit)
High Speed
Disadvantages
Human cannot identify
Machine depended
(Hardware depended)

11
About Machines & Languages
Machine defines a language
Set of instructions carried out by the
machine
Language defines by the machine
Machine executing all the program, writing
in the language
Machine
Language Language
12
Computer Language(s)
Machine contains
New Languages
(Ln) and the
Machine language
(LO)
Programming Language(L
n
)
Machine Language (L
0
)
Translate/
Interpreter
Machine
Program
ming
Language
(Ln)
Machine
Language
(L
0
)
13
Translation (L
1
L
0
)

1. Replace each instruction written in L1 in to
LO
2. Program now execute new Program
3. Program is called compiler/ translator
14
Interpretation
Each instruction in L1 can execute
through the relevant L0 instructions
directly
Program is call interpreter
15
Language Level Machine
16
High-level Language Program (C, C++)



Assembly Language Program



Machine Language

Programming Language
is an artificial language designed to
communicate instructions to a machine
Programming Language has
Keywords
Syntax
Semantics

17
Low-level Languages
An assembly language command such as

ADD X Y Z

might mean add the values found at x and y
in memory, and store the result in location z.

Assembly language must be translated to
machine language (zeros and ones)
0110 1001 1010 1011
The CPU can follow machine language
18
High-level Languages
Common programming languages include

C, C++, Java, Pascal, Visual Basic
FORTRAN
COBOL, Lisp

These high level languages
Resemble human languages
Are designed to be easy to read and write
Use more complicated instructions than
the CPU can follow
Must be translated to zeros and ones for the CPU
to execute a program

19
Compilers
Translate high-level language to
machine language
Input (Source code)
The original program in a high level language
Output (Object code)
The translated version in machine language
Example
C++ compiler, JAVA Compiler etc.


20
Tools & Tips for programming
Source code Editor
TextPad, Notepad
Compiler
JAVA Compiler, C++ compiler
Language Knowledge
Logical thinking ability


21
Programming with IDE
IDE : integrated design environment
consists of
source code editor
compiler and/or an interpreter
build automation tools
Debugger
Construction of a GUI
Class browser
Object inspector
Etc.

22
Programming IDEs
Eclipse
Eclipse is a multi-language software development environment
http://www.eclipse.org/
Netbeans
http://netbeans.org/
Microsoft Visual Studio
http://www.microsoft.com/visualstudio/en-us
23
Exercise
1. To solve the following problems, identify the input,
output and the process
a. Find the area of a room
b. Search a place of a city
c. Calculate grade for the given mark
2. What are the differences between compiler and
interpreter?
3. Why High-level language are useful than the Low-
level languages
4. Why Low-level is useful?
5. Search what are the compilers and IDE/Editors
available for the JAVA programming?
6. Search what are the existing Java based
applications?

24