UNIT 10: Computational Thinking Flashcards
what is computational thinking?
‘the abilyt to think logically about a problem and apply techniques for solving it’
simply working out how to work things out
closely related to the skill of designing algorithms which can be turned into computer programs
what is computer science about (no clue)
ts about using mathemical princples to solve problems
its not about how to use a spreadsheet, word or graphics package ephraim
it inovles learning to think computioanlly and applying the pricnpels of abstraction
what is abstraction
its a way of separating the logicla and physical aspects of a problem
if you are learning to drive a car, you concentrate on the function of the steering wheel, accelerator, brakes and so on
if u are learning to be a mechanic you will concentrate on how these things actually work
thinking abstractly what it involves
involves devising a model that represtns the reality- for example, think of a simple queue or sometjing as complex as a climate change model.
removing details that are not relevant to the problem
abstraction and reality (info hiding)
abstraction is an important tool in problem solving
all the details that do not contribute to the essential charactersitcs of the porblem are ommited
the london underground map is a good exmpale of information hiding
problem abstraction (what it involves)
involves removing details until the problem reduces to one which has already been solved
(types of recongition software kinda thing)
maps of diffrent places kinda thing
modelling and simulation (abstraction)
building a model of a real world object or phenomenon may be used to help solve a particular problem
comp scientists have to decide what details are relevant to the problem and discard everything else
algorthims and data structures can then be designed to solve the problem
algorhtim is then implemented in program code and executed
devising an abstract model
at its most abstract evel, a computational problem can be represented by a singl diagram
input - computational problem - output
input is info relevant to the problem, could for example be passed as parameters to a subroutine
output is the solution to the problem which could be passed back from a subroutine
thinking ahead
we need to take the inital abstract model and add detail to it until its transformed into a prgram
two major challenges to producing a solution
- algorhtim must be correct, must work for all possible inputs
- algorhithm muse be efficent- often a problem involed huge amounts of data, ahndling of records blah blah - so finding most efficent algrothim is important
identifying inputs and ouptus
subprocedure example
name - findmax
inputs - listint(1,2,3,3,45,)
ouptuts - an integer maxINT
advatnage of doucmenting inputs and outputs is that there is no ambiguity in what must be suplied to the subprocudure and what is returned
ambiguity! - quote
“i saw a man on a hill with a telescope”
specifying preconditions
precondtion - length of listINT > 0
must be fufilled before program works
advantages of specifying preconditons
- making program components reusable
- cutting out unecessary checks
with clear statemnt of preconditons, programmer knows what checks need to be made before calling the subprocedure and which are unnecessary - making programs easier to debug and maintain
resusable program components can be
added to a library and important whenever needed (cool stuff)
programming stadnards
if program modules are to be resusable they need to confrom to certain programming stadnards
this will help to make them easy to use for other programmers
typical progarmming stadnards for resusable modules
inputs outputs and preconditoins should be documented
variable identifiers should confrom to a stadnared convetion
all variables must be local to the module
doeumnetation should be in stadnard format, explaing what it does, who it was written by, date written
explaninongs / comments
no module should exceed one page of code
thinking ahead (predicting)
ancipating what the user wants to do next
caching
os systems think ahead using chaching
temporary storage of data and insturctions
last few instuctions of a program to be executed, the result of an earlier computation or data used ma y be stored in memeory so they xan be very quickyl retirved
ie web caching, pages and images and links what not
advantages of caching
faster acces to chached rescources
saving on costly use of bandwidth
reduced load on web services in a client server environment
disadvantages of caching
slower performance if the resource isnt found in the cache
being given a stale copy of a rescource when an up to date copty is needed
thinking procedurally
most problems of any size needs to be broken down into their compopnent parts
- what are the different aspects of this problem?
- is this a computational problem?
decompostion
breaking a problem into a number of sub probelms so that each sub problem accomoplishes an identifiable task
the sub problems may themselves be further sub divided
structued programming defintion
aims to improve the clarity and quality of a program
method of writing comp programs which uses :
modulrization - for program structe and organistiation, breaking prbolem down into subroutines
structured code for indiuval moduels - uses sequence, selection and iteration
recursion
what type of design model is structued programming ?
top down design
divded into subprodcueres or modules which are called from the main program
any of the subprocuedures may be further broken down into smaller subtasks with tthe samllest performing a single function
a HEIRARCHY CHART is often used to show the overall program stuructre