[ 2.1 ]
what is representational abstraction?
removing excessive details to represent a problem using only key features
must analyse what is relevant to a scenario and simplify a problem based on this
what is data abstraction?
details about how data is being stored are hidden
programmers can use data structures without knowing how they are implemented
what are layers of abstraction?
large, complex problems are split into layers of abstraction
each layer has a different role
the highest layers are the closest to the user
these are usually responsible for providing a user interface
the lowest layers perform tasks such as interacting with machine components
what is abstraction by generalisation?
grouping parts of a problem by common characteristics to arrive at a hierarchical relationship
allows problems to be categorised as being ‘of a particular type’
a common solution can be used to solve these problems
what is procedural abstraction?
allows programmers to utilise functions without knowing how they’re implemented
once a subroutine has been written, it can be reused as a black box
why is abstraction needed?
reduces programming time
reduces complexity of code (through abstraction by generalisation)
reduces the amount of memory/computational power required
simplifies the problem so it's easier to solve/understand
allows programmers to focus on core aspects of the problem
how is abstraction used for programming languages?
low-level languages interact directly with computers but are difficult to write
high-level languages abstract the machine code by providing easy-to-use syntax similar to natural language
this makes developing programs easier as high-level languages are easier to learn and use than machine code
how is abstraction used in the TCP/IP stack?
the TCP/IP model is an abstraction for how networks function
each layer deals with a different part of the communication process
each layer does not need to know how other layers function
name 4 things to consider when devising an abstract model.
what is the problem that needs to be solved by the model?
how will the model by used?
who will use the model?
which parts of the problem are relevant based on the target audience and purpose of the model?
why is it important that programmers identify the inputs and outputs of a problem?
all computational problems consist of inputs which are processed to produce an output
it is important to understand what information will be needed in the program
consider the data structures and data types involved
consider the input and output devices
by thinking ahead, developers can build programs that are easy and intuitive to use
what are preconditions?
requirements for inputs which must be met before a program can be executed
why are preconditions for inputs used?
specifying preconditions means a subroutine expects the arguments passed to it to be valid
these can be either…
tested for within the code (validating inputs)
included in the documentation accompanying the program
including preconditions within documentation reduces the length and complexity of the program
what is caching?
the process of storing instructions or data in cache memory after they have been used, as they may be used again
what are the benefits of caching?
frequently-accessed content can be quickly loaded, this frees up bandwidth for other tasks on a network
prefetching algorithms can predict which instructions are likely to soon be fetched,and load them into cache
less time is spent waiting for instructions to be fetched
what are the drawbacks of caching?
limited by accuracy of algorithms used
larger caches take a long time to search
smaller cache sizes limit how much data can be stored
what are reusable program components and why are they used?
reusable components include:
classes
abstract data structures (e.g. queues and stacks)
subroutines
commonly used functions are often packaged into libraries for reuse
teams might create a library of components so they can be reused throughout a project
problem decomposition is used to identify where previously-developed program components can be reused
what are the benefits of using reusable program components?
more reliable than newly-coded components as they have already been tested
saves time, money and resources
what are the drawbacks of using reusable program components?
components may need to be modified to be compatible with existing software
this can be more costly and time-consuming than developing them from scratch
what is problem decomposition?
problem decomposition breaks a large, complex problem down into smaller sub-problems which can be solved more easily
this makes projects easier to manage and they can be divided between programmers
what is top-down design?
problems are broken down into sub-problems until each sub-problem is a single, self-contained task
each sub-problem can then be solved using a single subroutine
commonly used to divide a problem between a team
subroutines can be developed and tested separately
why is the order in which subroutines are executed significant?
programs may require certain inputs to be entered in a particular order by the user before processing can occur
validating inputs must occur before the input data is used
in some cases, it may be possible for several subroutines to be executed simultaneously
what is concurrent thinking?
the process of completing more than one task at a given time
this does not always mean you have to be working on multiple tasks at once
involves giving ‘slices’ of your time to different tasks.
parts of a problem which are related can often be solved concurrently
what is concurrent processing?
processes happen at the same time // processes overlap
one process can start before another one finishes
each process is given a slice of processor time
different processes can be executed (in parallel) by different processors/cores
what are the benefits of concurrent processing?
more efficient processor use // less idle time for processor // greater throughput
long running tasks do not delay short running tasks
tasks requiring preconditions can wait and then resume execution
user is able to interact with the computer while other tasks are running
what are the drawbacks of concurrent processing?
there is an overhead in coordinating and switching between processes which reduces program throughput
not all tasks are suited to being broken up and performed concurrently