4.3 Introduction to programming

Topic 4. Computational Thinking

4.3 Introduction to programming


The fundamental operations of a computer.

  • Add
  • Compare
  • Retrieve
  • Store data
Complex capabilities are composed of very large numbers of very simple operations.

The essential features of a computer language.

Fixed vocabulary
Unambiguous meaning
Consistent grammar and syntax
Semantics: the meaning of every construction.
Syntax: the structure od every construction.

Explain the need for higher level language

Machine language

Machine language is a low-level language and is the only language that can be understood directly by a computer.
  • hard to write
  • difficult to debug and to maintain
  • machine language programs written for a computer if one kind are not suitable for a computer of another kiind

Assambly language

Assambly language is the binary code for development of instructions and reference to address locations with symbols call mnemonics.
  • An assambler was ised to convert the assembly language mnemonics to machine code.

High-level programming language

High-level programming language is a programming language that uses element oof natural is easy to use.
  • Makes the programm decveopment simpler, faster adn more undersigtuation.

Outline the need for a translation process from a higher level language to machine executable code.

Compiler

A translation that executes the translation process only oncy.
  • The object program is saved and no recompilation is necessary
  • Compiler issue error messages for all syntax error found and all errors are communicated to the programmer after the entire program is checked.
  • Much faster than intepreter
Example:C, C++

Interpreter

Translator that goes through the process of translation every time the program is run.
  • Reading each line of the source program.
  • Syntax error are communicated to the programmer for every instruvtion thay is interpreted.
Example:BASIC

Combines complation and interpretation: Java Virtual Machine (JVM)

When a java program is copiled from .java file to a .class file.
Mostly in other Programming Languages, compiler produce code for a particular system but Java compiler produce Bytecode for a Java Virtual Machine. When we compile a Java program, then bytecode is generated. Bytecode is the source code that can be used to run on any platform.Bytecode is an intermediary language between Java source and the host system.It is the medium which compiles Java code to bytecode which gets interpreted on a different machine and hence it makes it Platform/Operating system independent.
Java is called platform independent because of Java Virtual Machine. As different computers with the different operating system have their JVM, when we submit a .class file to any operating system, JVM interprets the bytecode into machine level language.