2.1 computational thinking Flashcards
deifine abstraction
abstraction is the act of removing unecessary details
why is abstraction implemented
because it can provide the same quality product while reducing the computational resources required
focus on the purpose of the program
reduce complexity fo the design
reduce programming coplexity
reduce memory requirements
define preconditions
Things to consider before creating the solution i.e
budget, time frame, current solution, current hardware, skill set etc
what are the three main aspects of thinking ahead
specifying inputs
specifying outputs
preconditions
what are the pros of defining preconditions
makes program components reusable
cutting out unecessary checks
makes the program easier to maintain
enhances modularity
reduces errors
what are the main programming standards
function shouldnt be longer than a page of code
variable identifiers must stick to a convention
each function must have a single entry point
variable must not be set up ouside the scope of the function (local variables)
how do operating systems utalise ‘Thinking ahead’
by caching frequently accessed data
this can be done with prefetching where an algorithm predicts the next data to be fetched and places it in cache before it is fetchied into the CPU
pros of caching
faster access
less bandwidth used
cons of caching and prefetching
disk thrashing may occur if used to often
there is a chance that the algorithm is wrong and the data prefetched isnt needed next.
define decomposition
breaking up the problem into small more managable sub-problems
what are the benefits of modularisation
large problems broken down easier to solve
subroutine can be tested individually
modules can be resued in several programs
frequently used modules can saved as libraries
programmers can work concurrently
programs have fewer errors
easier to debug
easier to maintain
what does a good algorithm include
clear set of steps to prodice the correct output
is efficient and completed in as few steps as possible
how is concurrent processing done
multiple cores
tasks broken down into subtasks
pros of concurrent processing
solution found faster
increase program throughput
(rate a system can complete a task)
cons of concurrent processing
more memory
more difficult to program
difference between parallel processing and concurrent processing
concurrent not actually simultaneously swaps between subtasks quicky
parallel
Describe the different ways a programmer could ensure that invalid data entries are not made by the user when selecting a venue and date for a cinema [4]
search box used to populate the venue
drop down menu for all the valid venues
calendar used for date
raneg check to make sure no 13th months
when developing a set of applications (like word ppt and excel) why is it good for developers to reuse code [4]
Pre-tested
pre-compiled
saves time and money
similar look
quicker to learn
more comfortable with products in this set
user becomes more productive
what is caching
The Process of storing instructions or data in cache memory
what is prefetching
operating system predicts the next item that will be fetched and it is pre loaded into cache
What are the goals behind thinking abstractly
meaning
identifying what does and doesnt matter
identifying the variables and objects needed
see levels of the problem (diff levels of abstraction)
What are the theoretical positives of thinking abstractly
simplifies the probelms/ interface (simplifies it for both the user and the developer)
reduces the computational complexity of the solution
easier to see how he solution could be applied to another problem
What are the cons of thinking abstractly
Models wont be as accurate
examples thinking abstractly
using icons and symbols
putting data in a chart
moving nodes on a graph to change how it looks
define thinking ahead
identifying the preconditions of a system (inputs outputs and reusable components)
What does thinking ahead entail
in a general sense
Identifying preconditions
Identifying the state the data needs to be in for the algorithm to work
Identifying what data is required before it’s needed (prefetching)
identifying reusable components
What theoretical pros of Caching
Can improve efficiency greatly
What are the cons of caching
can be difficult to implement
is only as good as the operating systems predictions
data prefetched not always accurate
what does thinking procedurally entail
identifying smaller sub problems
determine the order of sub problems are executed
what are the pros of thinking procedurally
problem are easier to solve
debugging is easier
What are the cons of thinking proceduraly
may not always be possible
(in an event driven program)
define thinking logically
identifying individual steps and decision points of an algorithm
Define Concurrently processing
more than one process happening at the same time
(seemingly)
what are the pros of concurrent processing
Increase speed
what are the cons of concurrent processing
May be difficult to program
Can sometimes result in deadlock
problem may not suit concurrency
Go to examples of abstraction
Simplified weather
buildings and trees removed
simplified physics
reduced scenery
etc