click below
click below
Normal Size Small Size show me how
2.1.2
| Question | Answer |
|---|---|
| Thinking ahead | helps to maximise code efficiency, and minimise errors. |
| Steps of thinking ahead | The first step to making a program is to determine the inputs and outputs. Starting by deciding the end goal (outputs), then backtracking to the inputs, is often easier. - It is also important to work out the processes |
| Preconditions | conditions that already exist + could affect how you devise a solution to a problem |
| Caching | instructions/data retrieved from secondary storage + placed into main memory (often remain there in case needed again, resulting in faster retrieval times) Useful for reducing amount of similar communication between 2 devices exchanging information |
| Prefetching | data being requested from main memory before it is actually required. Algorithms predict what instructions or data pieces will be needed soon and transfer them to registers. |
| Prefetching cons | These algorithms can be hard to implement, and if they are wrong the data has to be removed/flushed |
| Reusable Program Components | When writing a program, it is useful to consider what can be reused from other solutions, if you can write a subprogram that can then be reused later on, or if there is a library that has the code you are trying to write. |
| Reusable Program Components pros | Shortens development time Saves system resources Reduces redundant code |