2.1 Elements of Computational Thinking Flashcards
What is abstraction?
Making a problem easier to solve by removing unnecessary detail and leaving only fundamental components to provide a computational version of reality
Involves devising a model that REPRESENTS reality
What are computers models?
Store data about a topic and use these to model/predict behaviours
What are the uses of computer models and simulations?
Predictions of global warming, effects of climate change
Likely scale and effects of population increases
Number of doctors and teachers required in 10 years time
Prediction of likely consequences of an earthquake
Financial modelling to predict future profits/losses
Likely spread of disease such as Covid
Saving in field of a new car/aircraft design
What is thinking ahead?
Considering all possible inputs and outputs to a system
What format will the inputs be in and where do they come from (from user input or sensors)
What format will be the outputs be in (documents, sound)
What processes will need to take place on the data in the system
What is modular programming?
Taking a problem and breaking it down into smaller problems, each of which can be easier to solve
Splitting code into different subroutines and/or different files
What are the advantages of modular programming?
Can take different problems and distribute them across a team of developers
Each module can be reused, reducing memory footprint, speeding up development time and making coding more consistent
Each module should’ve been thoroughly tested
Saves development time as all developing simultaneously
Project can be easier to manage as you aren’t relying on one piece of code to be finished to do another
What is procedural decomposition?
Breaking a problem into a number of sub-problems so that each sub-problem accomplishes an identifiable task
Sub-problems may then be further subdivided
What is structured programming?
Aims to improve clarity and quality of code
Modularisation - for program structure and organisation, structured code for individual modules (code using sequence, selection and iteration), recursion
Uses top-down design techniques
Program divided into modules which are called from main problem
Any sub-procedures may be further broken down into smaller sub-tasks, with smallest performing single function
Hierarchy chart - used to show overall program structure
What is a hierarchy chart?
Each logical process broken down into smaller components until it can’t be broken down any further
Execution tasks place from left to right, always at the lowest level component
Selection and iteration not shown
What is thinking logically?
Identify the points where a decision has to be taken
Determine the logical conditions that affect the outcome of a decision
Determine how decisions affect flow through a program
What are the features of a good algorithm?
Has clear and precisely stated steps
Produces correct output for any set of valid inputs
Validates against invalid inputs
Terminates at some point
Should be efficient, execute 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 are the different methods for designing algorithms?
Hierarchy charts
Flowcharts
Pseudocode
What are hierarchy charts useful for?
Identifying major task and breaking these down into subtasks
What are flowcharts useful for?
Getting down initial ideas for individual subroutines
What is pseudocode useful for?
Will translate easily into program code
What is hand tracing useful for?
Figuring out how an algorithm works
Finding out why an algorithm is not working properly
How are trace tables used?
To write down contents of each variable as it changes during execution
If program contains a loop, helpful technique is to put loop condition as first column in trace table, even if other variables have been defined before
ONLY NEED TO ENTER THE VALUES THAT CHANGE INTO A TRACE TABLE
Why is caching used?
Impossible to store all data locally at once, ready to processed
What is caching?
Cache blocks of data that need to be processed - loaded from server to the client machine - so that data could then be processed at a quicker speed
Processed data can then be uploaded back to database on web server
When data cached, temporary copy stored so it can be accessed again faster
What are the benefits of caching?
By using blocks of data rather than constant access to and from database, reduces load on database server
If data in use is cached to client machine as block, if problem with server or connection to server then data can still be processed, reducing reliance on good connection to the server
What are the drawbacks of caching?
Decrease performance if database held away from client machine, as all data is processed locally
Problems synchronising data (if data cached onto machine and different copy held on server, could be issue with keeping data up to data and consistent if more than one machine able to access data at once)
Increase maintenance costs as database need maintaining (checking consistency of data)
If problem with server (crashes) then if data already on client’s machine then won’t be able to reuploaded
What is concurrent processing?
Where one process doesn’t need to finish before next process start
Multiple processors execute instructions simultaneously
What is parallel processing?
Using multiple processors
Each processor works simultaneously and independently
CONSIDERED CONCURRENT
How does concurrent processing work?
Tasks broken down into subtasks that can be assigned to separate PROCESSORS/run on different THREADS and therefore run independently
A task can begin without waiting for another task to FINISH FIRST so tasks can OVERLAP
Each thread starts and ends at a different time