2.1.2 - thinking ahead Flashcards

10

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

Why do we need preconditions?

A

To ensure the function never crashes.

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

advantages of specifying preconditions

A
  • Ensures that the user knows what checks must be carried out before calling the subroutine.
  • If there are no preconditions, the user can be confident that necessary checks will be carried out in the subroutine itself, saving unnecessary coding, making it easier to debug and maintain.
  • Makes the subroutine reusable.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

benefits of code reuse

A
  • shortens development time
  • saves system resources
  • lowers development costs
  • reduces redundant code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

advantages of pre-written routines

A
  • Already compiled so they are tested and error free.
  • Saves work for programmers, shortens overall development time and reduces costs.
  • May be used multiple times.
  • May have been written in a different source language.
  • Allows the programmer to use other prorammers’ expertise and is a more standardised approach to coding.
  • May require fewer developers to work on a project.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

caching

A

The temporary storage of program instructions or data that have been used once and may be needed again shortly.

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

advantages of caching

A

Improves speed and efficiency.

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

disadvantages of caching

A
  • The nature of predictive logic means caching algorithms can be very complicated to implement.
  • The wrong data is often fetched and cached, therefore it has to be removed/flushed.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly