1.2.4 Programming Paradigms Flashcards
What are programming paradigms?
A programming paradigm is the approach that a programming language takes to solve problems
What are the main types of programming paradigms?
Low Level Languages Object Oriented languages Declarative languages Procedural languages Functional languages
What are Low level languages?
Low level languages are very close to machine code, and tied to specific CPU families.
What are some advantages of using Low level languages?
They are well suited for close control of the CPU
They are very efficient - well optimised code written in LLL can be made to run very quickly compared to other paradigms
What are some disadvantages of using Low level languages?
They can be difficult to use as programming commands are quite obscure
You need to know a lot of detail about the internal structure of the CPU to program in assembly language
Low level languages produce the least portable source code
What are Procedural languages?
Procedural languages are one of the most common programming paradigms. Sets of instructions are grouped into subroutines and functions and they are imperative and sequential
What are some advantages of using Procedural languages?
Excellent for general purpose programming
Has been well explored and many books and references are avaliable on it
Good level of control is given to the programmer without having to know precise CPU details
Portable source code
What are some disadvantages of using Procedural languages?
There are many procedural languages - a programmer tends to have to specialise in one specific language
The programmer needs to be precise and knowledgeable about programming instructions - fully debugged programs take time to create
Not as efficient as low level languages
What are Object Oriented Languages?
Object Oriented Programming languages use templates, called classes to define items that they are working with. Classes are templates that have a set of attributes, and objects within a class share the same set of attributes, with the possibility of different values for these.
What are some advantages of using Object Oriented Languages?
It is easy to reuse classes for different programs and there are libraries of classes already written by people.
Organising data into classes containing methods makes it less likely to unintentionally overwrite data values
Classes are modular and can be tested without affecting the rest of the program
What are some disadvantages of using Object Oriented Languages?
Complicated and difficult to learn
Code is less compact and efficient compared to Low Level languages
What are declarative languages?
Declarative languages are not imperative. The programmer specifies what needs to be done, not how to do it. The software seeks a goal by interrogating a database containing Facts and Rules.
What are some features of Declarative Languages?
It is NOT sequential, it does not matter what order the Facts and Rules are arranged in
Mostly used in fields such as artificial intelligence and expert systems
Works well when data is inexact and decisions are general
Declarative languages have the ability to backtrack, to have a search go back and forward while checking criteria.
What are Functional Languages?
Functional languages specialise in answering problems purely through applying calculations to input. They do not change anything else other than the data provided. The calculations they apply are called functions.
What are some features of Functional Languages?
They do not change anything other than the data provided
Do not have side effects unlike procedural languages
Used extensively in highly mathematical areas such as engineering and finance.