Programming paradigms Flashcards

1
Q

Imperative

A

Control flow is an explicit sequence of commands

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

Declarative

A

Programs state the result you want, not how to get it

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

Structured

A

Programs have clean, goto-free, nested control structures

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

Procedural

A

Imperative programming with procedure calls

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

Functional (Applicative)

A

Computation proceeds by (nested) function calls that avoid any global state

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

Function-Level (Combinator)

A

Programs have no variables. No kidding

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

Object-Oriented

A

Computation is effected by sending messages to objects; objects have state and behavior

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

Object-Oriented: Class-based

A

Objects get their state and behavior based on membership in a class

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

Object-Oriented: Prototype-based

A

Objects get their behavior from a prototype object

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

Event-Driven

A

Control flow is determined by asynchronous actions (from humans or sensors)

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

Flow-Driven

A

Computation is specified by multiple processes communicating over predefined channels

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

Logic (Rule-based)

A

Programmer specifies a set of facts and rules, and an engine infers the answers to questions

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

Constraint

A

Programmer specifies a set of constraints, and an engine infers the answers to questions

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

Aspect-Oriented

A

Programs have cross-cutting concerns applied transparently

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

Reflective

A

Programs manipulate their own structures

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

Array

A

Operators are extended to arrays, so loops are normally unnecessary

17
Q

Concurrent by default

A

For example, imagine you wrote three lines of code, A, B, and C:

A;
B;
C;
In most programming languages, A would execute first, then B, and then C. In a language like ANI, A, B, and C would all execute at the same time!

18
Q

Dependent types

A

You’re probably used to type systems in languages like C and Java, where the compiler can check that a variable is an integer, list, or string. But what if your compiler could check that a variable is “a positive integer”, “a list of length 2”, or “a string that is a palindrome”?

This is the idea behind languages that support dependent types: you can specify types that can check the value of your variables at compile time.

19
Q

Concatenative languages

A

The idea is that everything in the language is a function that pushes data onto a stack or pops data off the stack; programs are built up almost exclusively through functional composition (concatenation is composition).

This sounds pretty abstract, so let’s look at a simple example in cat:

2 3 +