2.1.2 Flashcards
Thinking ahead (7 cards)
1
Q
Inputs
A
- An input is any data required to solve the
problem. - These may be entered by the user, or
obtained from hardware such as a sensor.
2
Q
Outputs
A
- Outputs are the solutions to the problem
which are returned. - They can only be produced once the
input has been processed. - It is important to consider the methods
used to capture data from the user and to
present it back to them. - Think about the data structures used.
- Think about the devices used.
- Think about what outputs are needed
first.
-Use this information to consider what
inputs are needed to produce the
required output.
3
Q
Preconditions
A
- Things which are needed before the program can run.
- The code expects the information passed to it to meet certain criteria.
- The code may test for these when it is run.
- They may instead be included within
documentation. - Including this information within documentation reduces the complexity of
the program and makes it easier to use. - Preconditions make it easier to reuse subroutines.
4
Q
Caching
A
- Values or information can be stored in memory after use.
- Prefetching uses an algorithm to predict which instructions may be needed next and store them in cache before they are needed.
- The accuracy of the algorithm’s predictions influences the effectiveness of this technique.
5
Q
Caching advantages
A
- Values or information can be stored in memory after use.
- This makes it quicker to retrieve them if they are needed again.
- Web pages are also cached in this way to improve load times and reduce bandwidth usage.
- Prefetching uses an algorithm to predict which instructions may be needed next and store them in cache before they are needed.
- This reduces the need to wait for an instruction to be loaded.
6
Q
Caching drawbacks
A
- A large cache can take a long time to search.
- Caching and prefetching can be difficult to implement.
7
Q
Reusable Program Components
A
- Common functions can be packaged into a library.
- This makes it easier to reuse them throughout a project.
- Abstract data structures, subroutines
and classes can all be reused in this
way. - Decomposition is used to indicate
where components of an existing program can be reused. - Reusable components have already been tested and so are more reliable.
- They make development less time consuming and therefore less costly.