Unit 10 Computational Thinking Flashcards
What is Abstraction?
A way of separating the logical and physical aspects of a problem such as removing less relevant parts of a problem
What are the advantages of specifying preconditions? (3)
- Clearly documenting preconditions helps to make the function reusable
- Cuts out unnecessary checks
- Makes the program shorter which helps to speed up debugging and maintenance
What are some typical standards for Reusable Modules? (6)
- Inputs, outputs and preconditions should be documented
- Variable identifiers should conform to a standard convention
- All variables must be local to the module
- Documentation should be in a standard format, explaining what the module does, who it was written by, date it was written
- Explanations of certain sections of code should be included where necessary
- No module should exceed one page of code
Why do Reusable Modules need to conform to certain programming standards?
To make them easy to use for other programmers
What is Caching?
Caching is the temporary storage of data and instructions. The last few instructions of a program or frequently used data could be stored
What are the advantages of Caching? (3)
- Faster access to cached resources
- Saving on costly use of bandwidth
- Reduced load on web services in a client-server environment
What is a disadvantage of Caching?
Slower performance if the resource isn’t found in the cache
What is Procedural Decomposition?
Procedural decomposition means breaking a problem into a number of sub-problems, so that each sub-problem accomplishes an identifiable task
What is Modularization for?
Program structure and organization, i.e. breaking the problem down into subroutines
What are the advantages of Modularization? (5)
- Large programs are broken down into subtasks/subroutines that are easier to program and manage
- Each subroutine can be individually tested
- Modules can be re-used several times in a program
- Frequently used modules can be saved in a library and used by other programs
- Several programmers can simultaneously work on different modules, shortening development time
What are features of good programming practice? (5)
- Use meaningful identifiers
- Define and document the inputs, outputs and preconditions for each sub-procedure
- Add lots of meaningful comments within the program
- At the bottom level, each sub-procedure should perform a single task
- Keep each sub-procedure self-contained by passing parameters and using local variables
What are features of a good algorithm? (5)
- Has clear and precisely stated steps that produce the correct output for any set of valid inputs
- Should allow for invalid inputs
- Must always terminate at some point
- Should execute efficiently, in as few steps as possible
- Should be designed in such a way that other people will be able to understand it and modify it if necessary
What is hand-tracing useful for? (2)
- Figuring out how an algorithm works
- Finding out why an algorithm is not working properly
What happens in Concurrent Processing?
Multiple processors execute instructions simultaneously
Tasks are broken down into sub-tasks that can be assigned to separate processors to perform simultaneously
What is Simulation?
The process of designing a model of a real system in order to understand the behaviour of the system, and to evaluate various strategies for its operation