Download: 2.1.2 Thinking Ahead
- Analyse the problem before you begin coding. Design a plan before you start. Plan for when you want to add future tasks. Plan to simplify frequent tasks in your code.
- Be able to identify what inputs and outputs are needed. For example, start with the end: what outputs does your client need? Then plan backwards: what data must be inputted in order to get these outputs.
- This means you have to be able to identify the values, which must be in place before the problem beings. For example: Static values may be held as constants. While, Dynamic (can change) values may be held as variables. These are change while the program is running.
- For example (Determine the preconditions for devising a solution) : A SATNAV system. INPUTS: What data is inputted at the start of the journey, during the journey? How is that processed? OUTPUTS: What information is presented by the system? How is that shown by the user?
- A cache is a small temporary storage area.
- This is done automatically by the operating system rather than the programmer.
- Caching is the temporary storage of program instructions or data that have been used once and may be needed again shortly. For example, the last few instructions of a program may be stored in cache memory for quick retrieval.
- Main benefit of caching is that it reduces access latency (lag). For example, in web caching, the storing of HTML pages and images recently looked at gives faster access to pages. This saves having to download pages again, which can use unnecessarily bandwidth.
Reusable Program Components:
- Software is modular, an example being functions / procedures.
- You can save useful code as modules.
- Modules can be transplanted into new software or can be shared at runtime through the use of program libraries.
- Modules will most likely be already tested. This means more reliable programs.
- This can mean less development times for programs as they can be shorted and modules can be shared.
591 total views, 1 views today