1.2.4 Types of Programming Languages Flashcards
What is a programming paradigm?
A style or a way of programming.
What is machine code?
- The least abstract - closest to what happens on a computer
- Directly into binary
- These translate into matching electrical signals
- One to one relationship
What are high-level programming languages?
Types of programming languages that are more closer to natural language, making it easier for humans to understand.
They have a many-to-one relationship, as each instruction of code is equivalent to many lines of machine code. Thus they are more complex.
What are low-level programming languages?
Types of programming languages that provide little or no abstraction from the machine instructions, allowing programmers to manipulate hardware elements (register, memory etc).
What are the types two types of low-level programming languages?
- Machine code
- Assembly
What is assembly?
- Uses mnemonics (match to a specific of 1s and 0s)
- One to one relationship
- Written in assembly language and translated by a specific assembler
- Uses symbolic addressing as labels to reference data locations
- Data is accessible to other parts of the program using parameter passing
What are the advantages of low-level languages?
- Assembly and machine have the same efficiency through 1-1 nature
- Very precise, locally optimised and efficient code
- You are in complete control of the code
- Provides access to system level features without going through system interface, improving program speed
What are the disadvantages of low-level languages?
- Machine-dependent and code is very hard to port
- Programmers to write efficient assembly code are rare
- Even for a talented programmer, code is tedious to write and very prone to bugs
- Code can be difficult to understand, so it’s hard to modify and maintain
What are the two categories of high-level languages?
- Declarative
- Imperative
What are declarative languages?
They focus on what a program is required to do, but not how they do it.
What are imperative languages?
They use statements that change the program’s state in the form of sequence, selection and iteration. They consist of commands for a computer to perform and focus on describing how a program operates.
What are the features of a procedural language?
- Sequence, selection and iteration
- Data stored in local/global variables
- Data accessible by addressing specific memory locations
- Structured into procedures and functions
- Logic is expressed in a series of procedure calls
What are the features of an object-oriented language?
- SSI + inheritance, objects, classes and encapsulation
- Data stored in attributes
- Data concealed from other parts of the program via encapsulation
- Programs structured into classes, methods and instances (objects)
- Logic is based on models and behaviours
What is a procedural (imperative) language?
One of the most common programming paradigms in use. They focus on telling a computer exactly what to do by sequential instructions.
What is a local variable?
A variable that can only be accessed within the specific subroutine it was declared in.