component 2 Flashcards
why is abstraction needed
programmer to focus on the important aspects of
a problem
which enables teams of programmers to work on different aspects of a problem
and
enables programmers to use pre-built and built-in functions without
concerning themselves with how they work.
examples of abstraction : 6
variables
✚ objects
✚ layers
✚ data models
✚ data structures
✚ entity-relationship diagrams.
diffremec between abstraction an reality
abstraction is a simplification of reality it does not take into account external factors of a problem from the real world (time delays)
do not give an exact or definite overview of the actual events in the real world.
abstraction in UI
remove distracting things and include
useful icons - times, volume signal strength
e.g car gps (inserted of film outside area use what is listed above)
and important information for user
why is thinking ahead important
maximise code efficiency
minimise erros
identify futur consequences
what does thinking ahead involved
s planning inputs and outputs.
thinking ahead Identify the inputs and outputs for a given
situation
n. When the
functions of a program are described, they are essentially a description of
what outputs it will produce. These may be:
✚ on-screen information
✚ printed data
✚ data to be stored
✚ actions for the computer to complete.
, the source of those inputs and the order and
format in which they are supplied is an important consideration.
The designer must decide upon the data types and data structures required
for the proposed solution to the problem.
define precondition
the requirements that must be met before the program
can run.
preconditions can be specified within documentation a
✚ requirements for the device specification to be able to run the program
✚ the operating system required to run the program
✚ any necessary additional software or hardware.
preconditions When planning the development of a program or routine:
When planning the development of a program or routine:
✚ subprograms will need the correct data passed to them
✚ input data should be validated to ensure it meets essential criteria
✚ actions need to be validated to ensure they will not crash the program if
erroneous results are returned.
what is caching
the process of storing instructions or values in cache memory after they have been used, as they may be used again.
how are reusable programs a benefit
Reusable components include implementations of abstract data structures such as queues and stacks as well as classes
hen designing a piece of software, the problem is decomposed: it is broken down into smaller, simpler tasks. This allows developers to identify where program components developed in the past, or externally-sourced components, can be reused to simplify the development process.
why is it better to use reusable program components
more reliable than newly-coded components, as they have already been tested. This saves time, money and resources.
Producing well-tested,reusable components means that they can be reused in future projects, saving development costs.
Disadvantage of use reusable programs
may not be compatible with the whole software so it may be a problem to integrate existing components This might mean these components need to be modified to work with existing software, which can sometimes be more costly and time-consuming than developing them in-house.
the process of thinking procedurally is Calle
decomposition
define decomposition
the process of breaking down large and complex problems into smaller sub- problems to make its more manageable and easier to solve
why is decomposition good
The project becomes easier to manage and can be divided between a team
designed used to show decomposition
top down hierarchy
1. the problem
2. main components
3. sub- problems for each main component
how ar steps ordered to solve a problem things to consider
When constructing the final solution, thinking about the order in which operations are performed is important.
● Programs may require certain inputs to be entered in a particular order by the user before processing can occur
Inputs need to be validated, and this must occur before this data is used.
what does thinking logically mean
understanding where decisions need to be made
and their consequences.
define paradigm
is used to specify an overall approach to writing program code.
conditions taht affect outcome of a decision
- order of importance
evaluation of conditions (is this option reasonable?it it conveieninent? etc)
what is concurrent thinking
the process of completing more than one task at a given
time.
how are you able to think concurrently
involves giving ‘slices’ of your time to different tasks.
● Parts of a problem which are related can often be solved concurrently.
what is occurrent processing
each task is given a slice of processor time to make it
appear as if tasks are being completed simultaneously.
what is parallel processing
when multiple processors are used to complete more than
one task simultaneously
benefits of concurrent processing
The number of tasks completed in a given time is increased.
Less time is wasted waiting for an input or user interaction, as other tasks can be
completed in this time
drawback of concurrent processing
● Concurrent processing can take longer to complete when large numbers of users or
tasks are involved as processes cannot be completed at once.
● There is an overhead in coordinating and switching between processes, which
reduces program throughput.
● Just as with parallel processing, not all tasks are suited to being broken up and
performed concurrently.
types of constructs used tor represent control flow
Sequence:Code is executed line-by-line, from top to bottom.
Branching:A certain block of code is run if a specific condition is met, using IF statements. This is also known as ‘selection’.
Iteration: A block of code is executed a certain number of times or while a condition is met.
spudocode representating number range
for i = 1 to 10
print (i)
next i
python representing number range
for i range (1,11)
print (i)
. Iteration uses
FOR, WHILE or REPEAT UNTIL loops.
Iteration can be either:
Iteration can be either:
- Count-controlled
for i in range (0,10):
print i
next i
Condition-controlled while i <= 20:
print “Not true”;
i=i+1
endwhile
what is recursion
a programming constrict which a subroutine calls its self during its execution until a certain condition is met
feature that make a problem solvable
1.Problem recognition:● Analysing strengths and weaknesses with the current solution
● Considering inputs, outputs, stored data and volume of data
2.Problem decomposition:broken down into smaller problems until each subproblem can be represented as a self-contained subroutine to reduce the complexity
3.Use of divide and conquer
4.use of abstraction :excessive details are removed to simplify a problem.(pre-programmed modules and libraries to be used rather than coding from scratch.)
5.Problem solving strategies
what is divide and conquer
Divide and conquer is a problem-solving technique that can be broken down into three parts: divide, conquer and merge.
- Divide’ involves halving the size of the problem with every iteration.
- Each subproblem is solved in the ‘Conquer’ stage, often recursively.
The solutions to the subproblems are then recombined during the ‘Merge’ stage to form the final solution to the problem.
what is divide and conquer
Divide and conquer is a problem-solving technique that can be broken down into three parts: divide, conquer and merge.
- Divide’ involves halving the size of the problem with every iteration.
- Each subproblem is solved in the ‘Conquer’ stage, often recursively.
The solutions to the subproblems are then recombined during the ‘Merge’ stage to form the final solution to the problem.
where is divide and conquer applied to
quick sort, merge sort and binary search
advantages of using divide and conquer
the size of the problem is halved with each iteration which greatly simplifies very complex problems.s the size of a problem grows, the time taken to solve it will not grow as significantly.
Disadvantage of divid and conquer
makes use of recursion, it faces the same problems that all recursive functions face: stack overflow will cause the program to crash and large programs are very difficult to trace.
types of problem solving strategies
Backtracking
Data mining
Heuristics
Pipelining
Visualisation
what is backtracking
roblem-solving technique implemented using algorithms, often recursively. It works by methodically visiting each path and building a solution based on the paths found to be correct.
what happens if a path is found invalid in back tracking
the algorithm backtracks to the previous stage
and visits an alternate path. Depth-first graph traversals
are an example of backtracking.
example of backtracking
maze
what is data mining
Data mining is a technique used to identify patterns or outliers in large sets of data collected from a variety of sources, termed big data.
uses of data mining
data mining is used in software designed to spot trends or identify correlations between data which are not immediately obvious.
benefits of data mining
Insights from data mining can be used to make predictions about the future based on previous trends.
used to see habits and preferences based on their personal information.
Disadvantages of data ming
dealt with in accordance with the present legislation regarding data protection as it involves the handling of personal data,
what are heuristics
A heuristic is a non-optimal, ‘rule-of-thumb’ approach to problem-solving which is used to find an approximate solution to a problem when the standard solution is unreasonably time-consuming or resource-intensive to find.
what is the solution of heuristics
The solution found through using heuristics is not perfectly accurate or complete.
uses of heuristics
to provide an estimated solution for intractable problems
A* algorithm, and are also used in machine learning and language recognition.
what is performance modelling
Performance modelling eliminates the need for true performance testing by providing mathematical methods to test a variety of loads on different operating systems.
benefit of performance modelling
cheaper, less time-consuming or safer method of testing applications.
uses of performance modelling
It is useful for safety-critical computer systems, where it is not safe to do a real trial run
what is pipeline
Pipelining is a process that allows for projects to be delivered faster, as modules are divided into individual tasks, with different tasks being developed in parallel.
i.e the output of one process in pipelining becomes the input of another, resembling a production line.
what is visualisation
Data can be presented in a way that is easier for us to understand using visualisation to produce graphs, trees, charts
benefit of visualisation
makes it possible to identify trends that were not otherwise obvious.
uses of visualisation
Visualisation is another technique that is used by businesses to identify patterns which can be used to inform business decisions.