Unit 10 - Computational Thinking Flashcards
define computational thinking
‘the ability to think logically about a problem and apply techniques for solving it’
define abstraction
separating the logical and physical aspects of a problem
what is computer science
using mathematical principles to solve problems, learning to think computationally and applying the principles of abstraction
define abstraction by generalisation
the grouping by common charcateristics to arrive at a hierarchical relationship
when is abstraction by generalisation usually used
OOP - classes and sub-classes
define data abstraction
involves creating a representation for data that separates the interface from the implementation so a programmer or user only has to understand the interface, the commands to use, and not how the internal structure of the data is represented and/or implemented
when is data abstraction commonly used
high-level languages
define problem abstraction
involves removing details until the problem reduces to one which has already been solved
when is problem abstraction used
you need to use problem abstraction to remove details until the problem can be represented in a way that is possible to solve because it reduces to one that has already been solved. e.g. using a database. timetabling and schedules are very common problems with well-defined solutions.
what is modelling and simulation and why is it used
- building a model of a real world object or phenomenon may be used to help solve a particular problem
- computer scientists have to decide what details are relevant to the problem and discard anything else
- algorithms and data structures can then be designed to solve a problem
- the algorithm is then implemented in program code and executed
define procedural decomposition
means breaking a problem into several sub-problems, so that each sub-problem accomplishes an identifiable task. the sub-problems may themselves be further subdivided
what is the simple diagram that represents a computational problem
define input
the information relevant to the problem, which could for example be passed as parameters to a subroutine
define output
the solution to the problem, which could be passed back from a subroutine
advantages of identifying inputs and outputs
there is no ambiguity in what must be supplied to the sub-routine
what are the two major challenges in producing a solution to a computational problem
- the algorithm must be correct - it must work for all possible inputs
- the algorithm must be efficient - often, a problem involves huge amounts of data
define precondition
a condition that must be fulfilled before other things can happen or be done
advantages of specifying preconditions
- documentation - the user knows what checks must be carried out before calling the subroutine
- no preconditions - user can be confident that necessary checks will be carried out in the subroutine itself, thus saving unnecessary coding
- reusable subroutine
structure for thinking ahead situations
Name:
Inputs:
Outputs:
Preconditions:
define caching
the temporary storage of data and instructions
examples of data that is cached
last few instructions of a program to be executed, the result of an earlier computation, or data used may be stored in memory so they can be quickly retrieved
define web caching
storing HTML pages and images recently looked at
advantages of web caching
- faster access to cached resources
- saving on costly use of bandwidth
- reduced load on web services in a client-server environment
disadvantages of caching
- slower performance if the resource isn’t found in the cache
- being given a stale copy of a resource when an up-to-date copy is needed
- for example, you access a database to get a list of available products, which is then cached
- you make a few other queries, then a few minutes later you have to make your original query again
- if the query results have been cached, you may see the same available products… but in fact, they have already been sold in the meantime
define prefetching
the loading of a resource before it is required - to decrease the time waiting for that resource.
examples of prefetching
instruction prefetching where a CPU caches data and instruction blocks before they are executed, or a web browser requesting copies of commonly accessed web pages
what does prefetching use
cache
define procedural abstraction
using a procedure to carry out a sequence of steps for achieving some task
define procedure interface
how it is called, what arguments are required, what data type each one is and what order they must be written in
define structured programming
aims to improve the clarity and quality of a program. it is a method of writing a computer program which uses:
1. modularization for program structure and organisation
2. structured code for the individual modules
3. recursion
example of modularization for program structure and organisation
breaking the problem down into subroutines
define structured code
sequence, selection, iteration