CIS11011
ESSENTIALS OF ICT AND PC APPLICATIONS
Lesson 4
MJ Ahamed Sabani
Department of ICT
Faculty of Technology
SEUSL
1
Computer Program
■ A computer program is a set of commands and instructions which
tell the computer what to do
■ It has a sequence of instructions to perform specified task by
computer
■ Programs are developed to solve problems using computers
2
Computer Programming
The process of developing and implementing a set of commands and
instructions using Programming languages to do specific task by a
computer
■ Computer program instructions can be called program source code
■ The process of programming can also be called program coding
3
Computer Programming Languages
■ A computer programming language is a set of rules and symbols
used to construct programs or computer application
■ It provides ways to instruct the computers
■ The “grammatical” rules of a programming language can be called
as syntax
■ It’s a tool for developing an executable model to solve problems
■ More than 2500 programming languages available
4
Classification of Computer Programming Languages
■ According to the level
– Low level languages
– High level languages
■ According to the generation
– 1st Generation languages
– 2nd Generation languages
– 3rd Generation languages
– 4th Generation languages
– 5th Generation languages
5
Classification of Computer Programming Languages (contd.)
1st Generation
Languages
Low Level
Languages 2nd Generation
Languages
Computer
Programming 3rd Generation
Languages Languages
High Level
Languages 4th Generation
Languages
5th Generation
Languages
6
Low level programming languages
■ 1st and 2nd generation programming languages
■ Computer understandable format
■ Closer to computer and its basic structure
■ Extremely efficient, making optimum use of both computer memory
and processing time
■ Very difficult to understand by the human
■ Only the programmers having knowledge about computer
architecture can code
7
High level programming languages
■ 3rd ,4th and 5th generation programming languages
■ Computer independent languages
■ Closer to human languages
■ Not much powerful, but reduce the time to program
■ Easy to work and edit by the human
■ Programmers do not need to have advanced knowledge in computer
architecture
■ Rely on the translators to convert into machine understandable
format
8
1st Generation languages
■ Machine languages
■ Computer can use these instructions directly
■ CPU natively understand these machine codes
■ No translators needed
■ Very powerful code
■ Mainly uses 1s and 0s (bits)
■ Very difficult to write programs
■ E.g.
– MIPS instruction set
9
2nd Generation languages
■ Assembly languages
■ Short names used for instructions rather than the bits
■ Computers can not understand directly
■ It needs to be assembled to execute by computer
■ Assemblers can be used to translate
■ Mostly CPU specific programs
■ Very fast
10
3rd Generation languages
■ Closer to human understandable language, but includes some
notations
■ Converters needs to translate into machine readable format
■ This can be done by a machine language system call Compiler
■ Converted machine language program can be called as object code
■ Interpretation can be done by a system program call Interpreter
■ E.g.
– Fortran, ALGOL, and COBOL
– C, C++, C#, Java, BASIC and Pascal
11
4th Generation languages
■ Closer to natural language
■ Fewer instructions enough to accomplish a task
■ Able to work with databases
– Queries
– Forms
– Reports
■ E.g.
– Python, Ruby, and Perl
12
5th Generation languages
■ Declarative languages
■ Visually and graphically developed interfaces
■ Normally compiled with 3rd and 4th generation languages
■ Functional based instructions
■ Rule or mathematical logic based
■ E.g.
– Prolog, OPS5 and Mercury
13
Programming Language Translators
■ There are different types of programming languages are used to
instruct the computer
– However, the basic structure of computers knows only the language with
1s and 0s – Machine Languages
– All programs except machine languages need translators
Translator
Source Code Object Code
14
Programming Language Translators (contd.)
■ Three types of programming translators
– Assembler
– Interpreter
– Compiler
15
Assembler
■ Assembler is used for converting the code of assembly language (low
level language) into machine level language
■ Self assembler or resident assembler:
– Runs on a computer and produces the machine codes for the same
computer
■ Cross Assembler
– Runs on a computer and produces the machine codes for another
computer
16
Interpreter
■ It is a program which is used to translates statements of a language
programs into a machine language
■ It translates one statement (line) into machine code at a time
■ Machine codes will not save permanently
■ It takes less memory and time to run
17
Compiler
■ It is a program which is used to translates high level language
programs into a machine language
■ It goes through the entire program and then translates the entire
program into machine codes
■ Machine codes are saved permanently. So that computers can use
to execute program later
■ It takes more memory and time to run
18
Compiler and Interpreter
19
Major Programming paradigm approaches
■ Imperative programming
■ Declarative programming
20
Imperative programming
■ It focuses on HOW to execute, defines control flow as statements that change a
program state
■ Gives full control to developers that are very important in low-level
programming
■ Consists of commands for the computer to perform
■ Developers are more concerned with how to get an answer step by step
■ Its type includes
– Procedure Oriented (procedural) programming
– Object oriented programming
■ E.g.
– Fortran, Java, C, C++
21
Declarative programming
■ It focuses on WHAT to execute, defines program logic, but not detailed
control flow
■ It simply expresses the logic of computation
■ It may automate repetitive flow along with simplifying code structure
■ It mainly focuses on end result
■ Its type includes
– Logic programming
– Functional programming
■ E.g.
– Miranda, Erlang, Haskell, Prolog
22
Procedure oriented programming
■ The method of break down a programming task into collection of
small parts such functions, variables, data structures, and
subroutines
■ Sequence of actions to be done
■ Top-down approach
■ Less secure –no hiding
■ Overloading is not possible
■ E.g.
– FORTRAN, Pascal, C, VB
23
Structured programming
■ Can be called as modular programming
■ Subset of procedural programming
■ Easier to understand and focuses on logical structures
■ It consist of main three control structures
– Sequence
– Selection
■ If, If-else
■ Switch
– Repetition
■ For
■ While do
■ Do while
24
Object oriented programming
■ A method of break down a programming tasks into objects that
expose behavior (methods) and attributes using interfaces
■ Uses real world
■ Bottom-up approach
■ More secure –can hide data
■ Overloading is possible
■ E.g.
– C++,C#, JAVA, VB
25
Integrated Development Environment (IDE)
■ Software program that is designed to help programmers and developers
to build software
■ It provides many features
– GUI
– Development environment
– Code automation tools
■ Most IDEs include
– Text/ Code editor
– Compiler
– Debugger
■ E.g.
– NetBeans, Eclipse
26
27