Retrograde software analysis
Encyclopedia
Retrograde software analysis is a set of software techniques related to software design
, development, software testing
, debugging
and code analysis.
All these methods emanate from executing a program backward - instead of taking input data and following the execution path, we start from the output data and, by executing the program backward, command by command, analyze data that could lead to the current output. The techniques are closely related to data-flow analysis
and retrograde analysis
used in game theory
. Somewhat counter-intuitive for a standard development cycle, where we switch a program between development and testing team, it offers many advantages.
it reduces the number of test cases from 2n to just n.
Design
Design as a noun informally refers to a plan or convention for the construction of an object or a system while “to design” refers to making this plan...
, development, software testing
Software testing
Software testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test. Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software...
, debugging
Debugging
Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program or a piece of electronic hardware, thus making it behave as expected. Debugging tends to be harder when various subsystems are tightly coupled, as changes in one may cause bugs to emerge...
and code analysis.
All these methods emanate from executing a program backward - instead of taking input data and following the execution path, we start from the output data and, by executing the program backward, command by command, analyze data that could lead to the current output. The techniques are closely related to data-flow analysis
Data-flow analysis
Data-flow analysis is a technique for gathering information about the possible set of values calculated at various points in a computer program. A program's control flow graph is used to determine those parts of a program to which a particular value assigned to a variable might propagate. The...
and retrograde analysis
Retrograde analysis
In chess, retrograde analysis is a computational method used to solve game positions for optimal play by working backward from known outcomes , such as the construction of endgame tablebases. In game theory at large, this method is called backward induction...
used in game theory
Game theory
Game theory is a mathematical method for analyzing calculated circumstances, such as in games, where a person’s success is based upon the choices of others...
. Somewhat counter-intuitive for a standard development cycle, where we switch a program between development and testing team, it offers many advantages.
Debugging techniques
After a bug is found, normally, the first task is to find which line is the last executed, then we follow the code backward calculating all possible values of variables and the state of objects before that line, step by step, until we discover the problem. All operations are reversed. Incrementing becomes decrementing, multiplication - division, we enter the loop by the opposite condition etc.Testing techniques
Every program has the set of actions, values or attributes which we expect at the exit. For example, for sorting, an array should be sorted at the exit. In order to analyze what a program does for each input, we start with the required output conditions or values and going backward, line by line, we collect the states that lead precisely to the output. Once we reached the program's entry point, we have got the complete set of initial states that cause the required output. The remaining input states and values are those that will not lead to the output. For example, in order to test a sorting algorithm, we start with all sorted outputs and then, by reversing the code execution, we try to find at the input all different permutations of values; any missing permutation is the one that the algorithm will not sort for. This technique can greatly reduce the number of test cases, for example, for sorting networkSorting network
A sorting network is an abstract mathematical model of a network of wires and comparator modules that is used to sort a sequence of numbers. Each comparator connects two wires and sorts the values by outputting the smaller value to one wire, and the larger to the other...
it reduces the number of test cases from 2n to just n.