A problem solving technique that allows one to imitate the thoughtprocess of a computerprogrammer when they are solving a problem or writing an algorithm or program.
Abstraction by Representation
Act of removingexcessive details from a problem to make it simpler to produce a solution. Abstraction often involves analysing a problem to see which details are not needed to solve the problem.
Abstraction by Generalisation
By grouping together similarities, problems can be categorised a being a particular type. All problems that are similar may have the same basicsolution.
Preconditions
Requirements which must be met before a program can be executed. Stating when preconditions have been met makes the function in question more reusable.
Concurrent processing
Concurrent processing is when tasks are given slices of processor time to make it appear to process simultaneously.
Reusable Components
Commonly used functions that are often packaged into libraries of easy distribution and reuse. When designing a piece of software, the problem needs to be broken down into smallersimpler tasks that are easier to solve. These individual tasks can then be analysed to see if they were previously needed or if they will be needed. The repeated section can be replaced by a reusable component.
Reusable Components: Pros and Cons
Pros: Saves time, money and resources.Reliable. Cons: Compatibility issues when integrating reusable components from a third party, resulting in a need for pre-installationmodification which is more costly and time consuming than producing them in-house.
How do programming languages show abstraction?
A programmer hides all but the relevant information about an object, reducing complexity, increasing efficiency and improving access to programming for non-specialists. The product will represent the original but not be an identical copy, as fine details have been omitted
Caching: Pros and Cons
Pros: Saves time, no delay, freeing up bandwidth. Cons: Pre-fetch requires an informed prediction, accuracy of prediction algorithm, cache size, difficulty of algorithm implementation.
Programming constructs
Selection, Iteration, Sequence
Sequencing
All instructions are executed once in the order that they appear.
Iteration
Group of instructions repeated for a set number of times or until an endcondition has been reached.
Selection
Select statement used to determine which part of the algorithm to jump to and which statements to execute.
Recursion
When a function calls itself original call is halted while subsequent calls run, till stopping condition is met. More suited to algorithms for trees that are naturally recursive. Code is shorter and denser so simpler to read and quicker to write. Reduces the size of the problem with each call but increases the number of variables so uses memory inefficiently. Can run out of stackspace causing it to crash but can be avoided with tail recursion. Difficult to trace as each frame on the stack has own set of variables. Slower than iterative methods due to stackmaintenance.
Global Variable
Declared outside the subroutine, meaning it is visible and can be accessed anywhere within the program. Difficult to integrate as complexity increases. Value can be changed from outside the subroutine, compromising the program.
Local Variable
Declared and visible inside subroutine. Can be used as parameters. Makes the subroutine reusable. Overrides global variables.
Subroutine
Program that accepts parameters so it can be used with different data inputs. Each subroutine is a small chunk of the problem, so it means it is easier to design, implement, debug and maintain. Easier to monitor and share development and progress. Reduces amount of code required.
Function
A subroutine that uses local variable inputs to do one thing and return a output.
Procedure
A subroutine that uses local variable, may edit those variables withing the scope of the procedure but doesn't not return a value. These are used to do tasks that don't require an output, like editing a database.
Parameter
Description of data used as a local variable used in a subroutine. Is given an identifier when subroutine is defined and the actual value is substituted in when the variable is called.
Pass by Value
When a variable is called, the data with that identifier is copied from memory and returned to the user. Changes only happen to the copy so the original is not corrupted by faulty or malicious algorithms.
Pass by Reference
When a variable is called, the algorithm passes the memory location of the variable. This means the original data can be edited.
IDE (IntegratedDevelopmentEnvironment)
A program used for develop programs with components by providing the following features: editing, stepping, variableswitching, debuggingtools, breakingpoints, code translation and compilation, testing and versioncontrol.
Debugging tools
Allows for inspection of variable values to allow for run-time detection of errors. Logical errors can be pin-pointed. A crash dump can be produced to show state of variables when error occurs.
Break Points
Causes the program to pause at strategic points to check the variable states and flow of control to determine logicerrors and undeclared identifiers.
Stepping
Executing code one statement at a time to observe path of execution and changes to variable states to determine error location.
Translator Diagnostics
Reports syntax errors and suggests solutions to the user. Sometimes recommendations are incorrect.
Variable Watch
Monitors status of variables and objects as it steps through the code and causes the program to halt when conditions are met.
Problem Decomposition
A large complex problem gets broken down into smaller simpler problems (divide and conquer). Order of execution needs to be considered to ensure dependencies are met.
Abstraction
Removal of unnecessary details that are not important to the algorithms logic. Saves memory, time whilst not detracting from the main purpose of the program.
Backtracking
Algorithm systematically looks for a solution by trying every pathway. When a pathwayfail, the algorithm retreats to the point of last success and continues from there.
Data Mining
Process of searching through vast amounts of data from multiple databases for relationships between components that are not immediately obvious.
Heuristics
Rule of thumb approach used when analysing all eventualities is unfeasible. Leads to a "good enough" result but not suited to life or death scenarios. Useful for poorly defined variables and identifying malware based on behaviour.
Performance Modelling
Virtual actions model the results of the implemented program which saves money and time if it is complex, dangerous or expensive. Makes use of predictions and randomness where real-life parameters are not full understood.
Visualisation
Presenting data in graphs and charts so trends and patterns are easy to understand.