You are on page 1of 18

Fundamentals of

programming
Metalanguage
Programming Languages are languages that people use that are similar to
human language, which will be translated into machine code for the computer
to understand.

Algorithm is a step-by-step problem-solving process in which a solution is


arrived at in a finite amount of time.

Flowchart is a graphical form of problem-solving process.

2
Metalanguage
A Token is the smallest individual unit of a program.

Comments are denoted by // for a single-line comment and /* at the start of


a block of statements to comment and */ to close the block of statements you
want to comment on.

Identifiers are Nouns that describe the identities of variables.

3
Metalanguage
Data types specify the different sizes and values that can be stored in the
variable.

Primitive type variables directly store data into their memory space.

Reference variables store the address of the object containing the data.

4
Evolution of Programming
Languages

• Machine languages

• Assembly languages

• Higher-level languages
5
Machine languages
• These are the first-generation languages that are the most basic
type of computer languages, consisting of strings of numbers the
computer’s hardware can use.

• Consists of binary or hexadecimal instructions.

6
Assembly languages
• These are second-generation languages, developers use cryptic
English-like phrases to represent strings of numbers.

• In assembly language, an instruction is an easy-to-remember


form called mnemonic

• The code is then translated into machine language, using a


translator called an assembler

7
Higher-level languages
• Higher-level languages are more powerful than assembly
language and allow the programmer to work in a more English-
like environment.
• Higher-level programming languages are divided into three
“generations”, each more powerful than the previous:
• Third-generation languages (eg. FORTRAN, COBOL, C, C++, BASIC)
• Fourth-generation languages (eg. SOL, CSS, Coldfusion)
• Fifth-generation languages (eg. Mercury, Prolog, OPS5)

8
Java Program
Java instructions need to be translated into an intermediate
language called bytecode.

Compiler: a program that translates a program written in a high-level


language into the equivalent machine language.

Java Virtual Machine (JVM): hypothetical computer developed to make


Java programs machine-independent.

9
10
11
Programming
Methodologies
Programming Methodologies
Algorithm: a step-by-step problem-solving
process in which a solution is arrived at in a finite
amount of time

Flowchart : a graphical form of problem-solving


process.

13
14
Programming design
Structured Object - Oriented
o A problem is divided into o In OOD, a program is a
smaller subproblems collection of interacting objects

o Each subproblem is solved o An object consists of data


and operations
o The solutions of all
subproblems are then o Steps in OOD
combined to solve the problem 1. Identify objects
2. Form the basis of the
solution
3. Determine how these
objects interact

15
Flowchart

16
17
Start

Int num;
int r;

r = num % 2

Yes Is r = No
Odd Even
1?

End
18

You might also like