ESSENTIAL of (CS/IT/IS) class 05 (Software concepts)
1. SEIYUN UNIVERSITY
College of Applied Science – CS department
Instructor: Dr. Mazin Md. Alkathiri
Information Technology Department
Seiyun University - Yemen
3. SEIYUN UNIVERSITY
College of Applied Science – CS department
Types of software
• System software
– Operating systems
– Programming languages
– Database systems
• Application software
– General office tasks (word processing, etc.)
– Accounting
– Design
– Factory automation
– …
4. SEIYUN UNIVERSITY
College of Applied Science – CS department
What is Computer Program
• A computer program is a series of instructions written in the
language of the computer which specifies processing operations
that the computer is to carry out on data.
• It is a coded list of instructions that tell" a computer how to
perform a set of calculations or operations.
• Programming is the process of producing a computer program.
Programming involves the following activities;
• writing a program,
• compiling the program,
• running the program,
• debugging the programs.
• The whole process is repeated until the program is finished
4
5. SEIYUN UNIVERSITY
College of Applied Science – CS department
Programming languages
• Machine language
• Assembly language
• High-level languages
6. SEIYUN UNIVERSITY
College of Applied Science – CS department
Machine language
• The lowest-level programming language which are the
only languages understood by computers.
• machine languages are almost impossible for humans to
use because they consist entirely of numbers.
• It is a programming language in which the instructions
are in a form that allows the computer to perform them
immediately, without any further translation being
required.
• Instructions are in the form of a Binary code also called
machine code and are called machine instructions.
• Commonly referred to as the First Generation l
6
7. SEIYUN UNIVERSITY
College of Applied Science – CS department
Assembly language
• Introduced in 1950s, reduced programming complexity
and provided some standardization to build and
applications.
• Also referred to second generation language.
• The 1 and 0 in machine language are replaced by with
abbreviations or mnemonic code.
• It consists of a series of instructions and mnemonics that
correspond to a stream of executable instructions.
• It is converted into machine code with the help of an
assembler.
7
8. SEIYUN UNIVERSITY
College of Applied Science – CS department
Automatically translating assembly
language to machine language
Assembler
Get X
Add Y
Store Z
...
11001000100
01100100011
10001011001
...
Assembly Machine
language language
program program
(“source code”) (“object code”)
• An assembler is a program that converts assembly language into
machine code.
• It takes the basic commands and operations from assembly
code and converts them into binary code that can be recognized
by a specific type of processor.
9. SEIYUN UNIVERSITY
College of Applied Science – CS department
Common features of Assembly
language
• Mnemonic code; used in place of the operation code part of
the instruction eg SUB for substract, which are fairly easy to
remember
• Symbolic Addresses which are used in place of actual
machine addresses. A programmer can choose a symbol and
use it consistently to refer to one particular item of data.
• Example FNO to represent First No.
• The symbolically written program has to be translated into
machine language before being used operationally. A (1 to 1)
translation to machine language,
• i.e. one symbolic instruction produces one machine instruction/code.
9
10. SEIYUN UNIVERSITY
College of Applied Science – CS department
examples of typical assembly
language statements
10
• INC COUNT ; Increment the memory variable COUNT
• MOV TOTAL, 48 ; Transfer the value 48 in the memory variable TOTAL
• ADD AH, BH ; Add the content of the BH register into the AH register
• AND MASK1, 128 ; Perform AND operation on the variable MASK1 and 128
• ADD MARKS, 10 ; Add 10 to the variable MARKS
• MOV AL, 10 ; Transfer the value 10 to the AL register
11. SEIYUN UNIVERSITY
College of Applied Science – CS department
High-level languages
• A Machine independent and a Problem oriented
(POL) programming language.
• High level language is portable across different
machine types (architectures);
• It reflects the type of problem solved rather than the
features of the machine.
11
12. SEIYUN UNIVERSITY
College of Applied Science – CS department
High-level languages
• High level languages are more abstract, easier to use
and more portable across platforms as compared to
low-level programming languages.
• A programmer uses variables, arrays or Boolean
expressions to develop the logic to solve a problem.
• Source programs are written in statements akin to
English.
• A high level language code is executed by translating it
into the corresponding machine language code with
the help of a compiler or interpreter.
12
13. SEIYUN UNIVERSITY
College of Applied Science – CS department
High Level language Translation
• High level languages need to be translated into machine
language which is the computer language. The
translation is done by a Compiler or Interpreter.
• The interpreter is a translation program that converts
each high-level language statement into the
corresponding machine code.
• The translation process is carried out just before the
program statement is executed.
• Instead of the entire program, one program statement at
a time is translated and executed immediately.
• When using an interpreter, the source code translated
every time the program is executed
13
14. SEIYUN UNIVERSITY
College of Applied Science – CS department
Interpreters are appropriate in
• Handling user commands in an interactive system
• Debugging programs as they run (removing
program faults).
• Handling software produced for or by a different
computer.
14
15. SEIYUN UNIVERSITY
College of Applied Science – CS department
The compilers
• A compiler is a manufacturer specifically written
computer program which translates (or compiles) a
source code written in a high level language into
the corresponding object code of the low level
language.
• The translation process is called compilation.
• The entire high level source code / program is
converted into the executable machine code file
prior to the object program being loaded into main
memory and executed.
15
16. SEIYUN UNIVERSITY
College of Applied Science – CS department
A Compiler:
• Translates the source program code into machine
code
• Includes linkages for closed sub-routine
• Allocates areas of main storage
• Produces the object program.
• Produces a printed copy (listing) of the source code
and object code
• Produces a list of errors found during compilation.
16
17. SEIYUN UNIVERSITY
College of Applied Science – CS department
Automatically translating high-level
language to machine language
Compiler
Z = X + Y
...
11001000100
01100100011
10001011001
...
High-level Machine
language language
program program
(“source code”) (“object code”)
18. SEIYUN UNIVERSITY
College of Applied Science – CS department
Computer Program Compilation Process
• A computer program compilation process involves the following five stages;
1. Lexical analysis: the source program is transformed into tokens. During the
transformation all whitespaces and comments are discarded. All character
sequences that do not form valid tokens are discarded and an error message
is generated.
2. Syntactical analysis: analysis to ensure the program syntax is appropriate to
the language. Failure results in an error message been generated.
3. Type / Semantic checking: responsible for ensuring that the compile-time
semantic rules of the language are enforced. An error message is generated if
the semantic rules are violated
4. Code optimization: improves the intermediate code based on the target
machine architecture
5. Code generation: target machine code is generated
18
19. SEIYUN UNIVERSITY
College of Applied Science – CS department
High-level languages - Examples
• Fortran
• Basic
• Visual Basic
• C
• C++
• Java
20. SEIYUN UNIVERSITY
College of Applied Science – CS department
!AVERALQFL QFXELERG EFXEREH XRRVWLR XRE UEDPVARH
KLG
PRQFX �XRQG P R V L R A I YQLL JQFH XRE AVERALE V J QFXELERG DVW EFXER”
PRQFX �XRRVWLR XRE UEDPVARH. XDPE 999 XV QFHQKAXE XRE EFH V J HAXA.”
PRQFX
GWIZO
KVWFXER ZO
PRQFX �PLEAGE EFXER A FWIPER”
QFPWX F W I P E R
HV YRQLE F W I P E R `> 999
GWI ZGWI � F WI PER
KV WF XERZKV WF XER�
6
PRQFX �PLEAGE EFXER XRE FEXX FWIPER”
LV
QFPWX F W I P E R
A
VP
VERALEZGWI+KVWFXER
PRQFX �XRE AVERALE V J XRE F W I P E R Q
G
”
2AVERALE
EFH
Example 1 – Basic
23. SEIYUN UNIVERSITY
College of Applied Science – CS department
High level languages categories
High level languages can be classified into the
following categories;
• Procedure-oriented languages (third generation)
• Problem-oriented languages (fourth generation)
• Natural languages (fifth generation)
23
24. SEIYUN UNIVERSITY
College of Applied Science – CS department
Procedure-oriented languages
• High-level languages designed to solve general-
purpose problems,
• example BASIC, COBOL, FORTRAN, C, C++ and JAVA.
• They are designed to express the logic and procedure
of a problem.
• Though the syntax of the languages may be different,
they use English-like commands that are easy to
follow. They are portable.
24
25. SEIYUN UNIVERSITY
College of Applied Science – CS department
Problem-oriented languages
• Problem-oriented languages also known as Fourth
Generation Languages (4GL) are used to solve
specific problems and includes
• query languages, report generators and Application
generators which have simple English like syntax rules.
• A single statement of the 4GL can perform the
same task as multiple line of a third-generation
language.
25
26. SEIYUN UNIVERSITY
College of Applied Science – CS department
Natural languages
• Natural languages widely known as fifth generation
languages,
• designed to make a computer to behave like an
expert and solve problems.
• The programmer just needs to specify the problem
and the constraints for problem solving.
• Natural languages such as LISP and PROLOG are
mainly used to develop artificial intelligence and
expert systems.
26
Editor's Notes
A program written in assembly language consists of a series of instructions--mnemonics that correspond to a stream of executable instructions, when translated by an assembler, that can be loaded into memory and executed.
For example, an x86/IA-32 processor can execute the following binary instruction as expressed in machine language:
Binary: 10110000 01100001 (Hexadecimal: B0 61)
The equivalent assembly language representation is easier to remember (example in Intel syntax, more mnemonic):
mov al, 61h
This instruction means:
Move the value 61h (or 97 decimal; the h-suffix means hexadecimal) into the processor register named "al".
Each computer architecture and processor architecture has its own machine language.
On this level, each instruction is simple enough to be executed using a relatively small number of electronic circuits.
Computers differ by the number and type of operations they support.
For example, a new 64-bit machine would have different circuitry from a 32-bit machine.
They may also have different sizes and numbers of registers, and different representations of data types in storage.
While most general-purpose computers are able to carry out essentially the same functionality, the ways they do so differ;
the corresponding assembly languages reflect these differences.