2.1 Elements of Computational Thinking Flashcards
What is abstraction?
The removal of unnecessary data and excess details from a problem to allow us to focus on solving the core problem - that only consists of the key features.
What are the abstraction methods?
Abstraction by Generalisation.
Data Abstraction.
What is abstraction by generalisation?
Grouping similar problems together so that they can be tackled together.
What is data abstraction?
Not thinking about where data is stored.
What is the need for abstraction?
Allows for more efficient design during software development as you focus on the points that need to be built rather than the unnecessary details.
This makes programming quicker and easier as there is less to code.
It also prevents the program from getting unnecessarily large.
This means that hardware is used better and it makes better use of available processing resources.
How does abstraction relate to reality?
Abstraction is a simplified representation of reality. Real-world entities may be replaced with computational structures such as tables and databases.
When abstracting a problem what must first be identified?
The problem that must be solved - so that it isn’t removed by accident.
What is involved with thinking ahead?
Inputs.
Outputs.
Preconditions.
Why do you need to identify inputs and outputs?
Means that there is no ambiguity in what is needed and what isn’t.
What are preconditions?
Requirements that must be met prior to the program being executed. If the preconditions are not met the program will fail, or return an invalid answer.
How do you use preconditions to your benifit?
Means that you do not have to carry out unnecessary checks. Preconditions can be checked before a sub-procedure to ensure that they run correctly.
What is re-usable code?
Well defined and documented procedures that can be used in multiple programs or multiple times within the same program.
What is the benefit of reusable code?
Easier to debug and maintain the programs as they will be shorter.
Less debugging needed as the sections are already checked.
Saves money of writing and testing functions.
Means that some complex parts of the program don’t have to be remade every time.
How can reusable code be implemented?
Added to a library and imported when needed.
What is caching?
The temporary storage of data and instructions in cache memory so that they can be used again.
What is stored in cache?
The last few instructions of a program.
Results of earlier computations of data.
Why is cache used?
So that the instructions and data can be accessed and retrieved quickly.
What is web caching?
Storing HTML pages and images that have been recently retrieved so that the page can be loaded quicker if opened soon after.
What is CPU caching?
Storing frequently used instructions and data within the CPU - making it quicker as you don’t have to go to RAM.
What are autosaving documents?
Documents that save as you work
How do autosaving documents work?
Store data in cache so that in the event of a crash the data isn’t lost!
What are the advantages of caching?
Faster access to cached resources.
Saves on costly bandwidth.
Reduces load on web servers on client server databases.
What are the drawbacks of caching?
Slower results if not found in cache as RAM will then have to be searched following the initial search of cache.
Doesn’t work when the file name changes.
You could be given an old copy of something as that is the one that has been cached.
Loss of privacy as people could see old versions of websites.
What is procedural decomposition?
Breaking a problem down into a number of sub-problems so that each sub-problem accomplishes an identifiable task.
How can procedural decomposition be aided?
Structure Diagrams