Types of programming languages Flashcards
What is a programming paradigm?
A different approach to using a programming language to solve a problem
State the two categories of programming paradigm
Imperative
Declarative
State one type of imperative paradigm
Procedural
Object Oriented
State one type of declarative paradigm
Logic
Functional
Define imperative programming
Code that clearly specifies the actions to be performed
Define declarative programming
Code that focuses on stating the desired result rather than a series of instructions that need to be performed to get the result
Define procedural programming
Code which uses a sequence of instructions carried out step-by-step, which may be contained within procedures
When should procedural programming be used?
For problems that can easily be expressed as a series of instructions using programming constructs
State two advantages of procedural programming
- Can be easily applied to a wide range of problems
- relatively easy to write and interpret
State two languages that use procedural programming
Pascal
Python
Logo
Name a subsection of procedural programming
Structured programming
State the programming structures of structured programming
Sequence
Selection
Iteration
Recursion
Define sequence
Where code is executed line-by-line from top to bottom
Define selection
Define iteration
Where a block of code is executed a certain number of times or while a condition is met
Define recursion
Where functions are executed until a base case condition is met
- functions are expressed in terms of themselves
Define object oriented programming
A programming language where the code is made up of units called objects, which are instances of a class
What are objects?
Instances of a class which have their own attributes and methods and can interact with each other
What is a class?
A template defining the attributes and methods that can be used to create an object
Define encapsulation
A method of maintaining data integrity by only allowing class methods to access data in an object’s attributes
Define instantiation
The process of creating an object from a class template