2.1.2 Thinking ahead Flashcards
1
Q
What is Thinking Ahead?
A
- Considering issues you are likely to encounter in the future
2
Q
What are the features of Thinking ahead?
A
- Identify inputs and outputs
- Determine preconditions
- Caching
- Reusable components
3
Q
What are Preconditions?
A
- Requirements which must be met before a program can be executed
- Set on the data processed by the program
- Can be tested for within code but are more often included within documentation
4
Q
What are the advantages of specifying preconditions?
A
- Sepcifying preconditions withing documentation lets the user know what checks must be carried before calling subroutine
- Specifying within documentation reduces the length
and complexity of the program - Clear documentation helps make the subroutine reusable
5
Q
What is the need for Reusable Program Components?
A
- Commonly used functions are often packaged into libraries for reuse.
- Having components which are already written,debugged and tested will save time
- Simplified development process
- Compatibility issues may require components to be modyfied
6
Q
What is caching?
A
- Process of storing instructions or values in cache memory after they have been used, as they may be used again.
- Very common in the storage of web pages
7
Q
What are the advantages of caching?
A
- Saves time which would be needed to store and retrieve instructions from secondary memory
- Content of webpages can be loaded without any delay
- Images and text dont have to downloaded again, freeing up bandwidth
8
Q
What are the disadvtages of caching?
A
- Effectiveness of caching depends on how well a caching algorithm is able to manage the cache.
- Larger caches take long time to search so cache size limit how much data can be stored.