Procedural programming paradigm(1.2.4 b) Flashcards

1
Q

What is the procedural programming paradigm?

A

where code is made up of seperate blocks of code that do a specific task called procedures

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

What is structured prgramming?

A

using the fundamental programming constructs sequencing selection and iteration

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

What does the term spaghetti code mean?

A

the goto command used to be used to manually direct the flow of the program and the code was so interconnected it was really hard to follow

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

What is procedural programming?

A

built on the idea that all code can be broken down into the three programming constructs, procedural takes this idea a step further by reducing long programs into a series of subroutines

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

Procedural programs

A

should have single point of entry
encourages programmer to think about what a program does

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

Procedural programs subroutine form

A

many languages use in form of subroutine
called main which is automatically called when program is run
main subroutine then calls other subroutines to execute the programs main tasks

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

What happens if the subroutine has meaningful identifiers?

A

the main function is self-documenting

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

Why is procedural programs sometimes called top down problem solving?

A

as we start with a large problem and break it down into smaller discrete subproblems which can be solved independently
key part of modular design

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

Benefits of procedural programming

A

easier to test and debug as fewer lines of code to trace through
subroutines can be called many times reducing amount of repeating code
subroutines can manipulate shared data (global variables)
code is reusable as subroutines can be saved in libraries and imported into programs when needed
very large programs can be worked on by a whole team of programmers who can develop subroutines concurrently so that a project can be completed faster

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

Drawbacks of procedural programming

A

focuses on what needs to be done rather than on the integrity of the data that it manipulates
global variables often can cause issues with data integrity
nothing in the procedural paradigm that truly protects data
data is passed into subroutines used and sometimes modified and the programmer must be fully aware of what they should and shouldn’t do and abide by the rules of good practice to ensure data integrity

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