2.1.2 Thinking Ahead Flashcards
What is the purpose of thinking ahead?
- Allows developers to consider problems/difficulties that may arise when software is used
- Makes programs easy and intuitive to use
What are inputs?
- Any data that is required to solve a problem, often entered into a system by a user
- What the system needs to process
What are outputs?
- The results that are passed back once the inputs have been processed and the problem solved
- What the system should produce
Give examples of inputs
- Keyboard
- Mouse
- Microphone
Give examples of outputs
- Speaker
- Printer
- Monitor
What considerations do programmers need to make about inputs and outputs when thinking ahead?
- Data structure used
- Data types used
- Order of data
What are pre-conditions?
- Conditions that already exist which may affect how you devise a solution to a problem
- Requirements which must be met before a program can be executed
Where can preconditions be defined?
- Within the code or within documentation
State three advantages of including preconditions within the documentation accompanying a sub-routine
- Reduces the length and complexity of the program
- Saves time to debug and maintain a longer program
- Makes subroutines more reusable
What is caching?
- The process of storing instructions or values into cache memory after they have been used as they may need to be used again
- Instructions/programs retrieved from secondary storage and placed into RAM remain there in case they are needed again before the program using them ends
How is caching used in storing web pages?
- The web pages a user frequently accesses will be cached so the next time it is accessed, content can be loaded without delay
- Reduces the requests from the client to the web server and vice versa
What are the advantages of caching web pages?
- Content can be loaded without delay
- Images and texts do not have be downloaded multiple times
- Frees bandwidth for other tasks on a network
- Less time is spent waiting
What is prefetching?
- Involves data being requested from RAM by the processor before it is actually required
Give limitations of caching
- Accuracy of algorithms used in prefetching/wrong data is often fetched and cached which then has to be removed
- Maintaining correct sequence of data is problematic
- Predictive logic - caching algorithms are complicated to implement
State some advantages of using reusable program components
- Shortens development time
- Saves systems resources
- Lowers development costs
- Reduces redundant code
State disadvantages of using reusable program components
- May be compatibility issues with the rest of the software
- Components may need to be modified, sometime more costly and time-consuming than developing in house
What is an advantage of caching?
- Faster retrieval times as fetched data from secondary storage is much slower than fetching from RAM
What are the advantages of pre-written routines
- Compiled, tested and error free
- Use of libraries saves development time
- May have been written indifferent source language
- Programmers can take advantage of other programmers’ expertise