Presentation on theme: "PROGRAMMING 8.0. 8.1 Introduction To Programming Definition Types Of Programming Languages Programming Language Paradigm Translator 8.1.1 8.1.2 8.1.4."— Presentation transcript:
8.1 Introduction To Programming Definition Types Of Programming Languages Programming Language Paradigm Translator 8.1.1 8.1.2 8.1.4 8.1.3
Learning outcomes Define programming language Differentiate between Low-level and High- level language. Identify the functions of translators. State paradigms of programming languages. 8.1.1 8.1.2 8.1.4 8.1.3
Programming Languages a set of conventions (words, abbreviations and symbols) in which instructions for the machine are written. That tell the computer to perform task. – Just as human beings communicate with each other through the use of languages such as English, Spanish, Hindi, and Chinese, programmers use a variety of programming languages to communicate with the computer 8.1.1
Types of Programming Languages High-level Language Example : FORTRAN, COBOL, C, C++, C# Low-level Language Example Codes : Assembly Language ; MOV, MUL, LOAD, ADD Machine Language ; 0110 1100 1011 8.1.2
Programming Languages Low-level Language – consist of a :- Machine language, and Assembly language. High-level Language
Low-level Prog. Languages : Machine Language Machine Language Sometimes also referred to machine code or an object code. Instructions is in the form of a machine code (0 s or 1 s ), example : 0010 0101 0110 That is the only language the computer directly recognizes. Representing the only way to directly communicate with the computer. Hard to understand (tedious) and it is error-prone language, thus require highly trained programmers.
Low-level Prog. Languages : Assembly Language Assembly Language Using mnemonics in place of 0s and 1s in the program. Mnemonics / symbolic instruction codes – alphabetic abbreviations for instructions Example : LOAD, MOVE, ADD, MUL It is still hard to write (tedious) and it also requires highly trained programmers.
Low-level Prog. Language Machine Language and Assembly Language
Programming Languages Low-level Language – consist of a :- Machine language, and Assembly language. High-level Language – Using an instructions that more closely resemble the English language. examples of High-level programming languages ; FORTRAN, COBOL, C, C++, C#
High-level Prog. Languages High-level programming language Vast improvement over low-level language (machine and assembly language) allow the programmer to use instructions that more closely resemble the English language. machine independent compared to machine and assembly languages * programs written in a high-level language can be used on many different types of computers.
Differences of Low-level vs High-level Language Low-level Language (Machine and Assembly Language) High-level Language Machine-dependent – runs only on one type of a computer Often machine-independent – can run on many different types of computers and operating systems. Hard to write and to understand, thus requires highly trained programmers. Allow programmers to write an instructions that more closely resembles the English language. Using an assembler (a translator) – to translate an assembly language to a machine code. Using a compiler or an interpreter (a translator) – to translate high-level language into a machine code. 8.1.2
The Translator Translator – is a computer program that ; – translates a computer program written in a given programming language into a functionally equivalent program in a different computer languages. 8.1.4
Translator for Machine Language ? Case #1 : Do a translator need to translate a code written in machine language into a machine language ? Answer : NO translation needed.
Translator for Assembly Language ? Case #2 : Do a translator need to translate a code written in assembly language into a machine language ? Answer : YES, translator use an Assembler
Translator for High-level Language ? Case #3 : Do a translator need to translate a code written in high-level language into a machine language ? Answer : YES, translator use a Compiler or an Interpreter
Machine Language to Machine Language Assembly Language to Machine Code High-level Language to Machine Code No translator needed (because similar language) need a translator called Assembler need a translator called Compiler 1 or Interpreter 2 Assembler - a program that translates a program written in assembly language into an equivalent program in machine language. 1 Compiler - a program that translates entire instructions written in a high-level language into the equivalent machine language 2 Interpreter – a program that translates the instructions line by line as the program is running.
Programming Language Paradigm Computer languages are categorized according to the approach they use to solve a problem. A paradigm, therefore, is a way in which computer language looks at the problem to be solved. 8.1.3
Programming Language Paradigm StructuredObject-oriented Top-down approachBottom-up approach Program is represent as a logical structure Program is written as a collection of objects which communicate with each other. Flow of execution of the programming is dependent on the structure of the program The basic entity is object. Each computation is performed using object only. Can handle up to moderately complete program Can handle very complex programs. Less data security, less code reusabilityMore data security, more reusability Abstraction is less.Abstraction is more. 8.1.3
references D. Zak (2011) An Introduction to Programming 6 th Ed. Cengage Learning. DS. Malik (2011) C++ Programming 5 th Ed. Cengage Learning.