3.3 Programming Paradigms Flashcards

1
Q

What is a programming paradigm

A

A style or way of programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Imperative programming

A
  • Languages which support imperrative programming consist of series of instructions that tell the computer what to do with the input in order to solve the problem
  • Procedural programming is imperative programming with procedure calls
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Structured programming

A
  • A kind of procedural programming paradigm which uses the constructs sequence, selection and iteration and recursion rather than goto statements
  • Modular techniques are used to split a large program into manageable chunks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Declarative programming

A

Programming where you write statements that describe the problem to be solved, and the language implementation decides the best way of solving it (SQL)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Logic programming

A

A form of declarative programming which expresses the logic of a computation without expressing its control flow. They mostly consist of logical statments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Backtracking

A

Backtracking goes back to the last decision point and try another route until either the goal is achieved or there are no further routes to try
Backtracking is important feature of declarative programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Applications of declarative programming

A

It is useful for programming expert systems, which embody the facts and rules about a particular field of knowledge
It is also useful for processing natural language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

OOP

A
  • OOP was made because to abstract details of implementation away from the user
  • The code is designed to be reusable and easy to maintain
  • Mainly takes over procedural programming
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Features OOP

A
  • Thinking about different methods that the object can represent, for example required tasks
  • They also can have different attributes specific to that object
  • Data items are called ‘objects’, where objects are instances of the class
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Encapsulation

A

Attributes are usually only classified as private, so only public methods can only be used as getters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Information hiding

A

The object’s attributes are hidden, and they can only changed or accessed through the object’s methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are methods used for

A

To set setters and retrieve getters are used in order to get an object’s attributes.
In order to interact with an object, its methods must be accessible (public)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Inheritance

A
  • Used when objects are related to other ones in some type of way.
  • Each class may even have their own attributes and methods to something that was also inherited from a super class
  • The subclass has the same attributes as the the superclass
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Polymorphism

A
  • An inherited class may have methods and attributes that do not exist in the parent class
  • Polymorphism refers to subclasses adopting different methods (many different ways of doing the same thing specific to that class)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Functional

A

Functions are used as the fundamental building blocks of a program
- Statements are written as a series of functions which accept input data as arguments and return and output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Procedural programming

A
  • A series of instructions that tell the computer what to do with the input in order to solve the problem
  • Widely used in educational environments, being relatively easy to learn and applicable to a wide variety of problems
17
Q

Advantages of the OOP

A
  • Forces designers to go through an extensive planning phase which makes for better designs with fewer weaknesses
  • Encapsulation
  • A programmer may not need knowledge of how the class methods are used in order to actually use them
  • Can be re-used easily
  • Provides a good framework for code libraries with a range of software components that can easily by adapted by a programmer
  • Software maintenance is usually easier