|
Notes > Software Analysis / Testing > Program Slicing
|
Program slicing is a technique which can be used to remove sections of code within a program so that a certain part of the code's functionality / behaviour can be focused on. Program slicing removes any code that does not have an affect on the variables under test.
Program slicing is useful because it allows the tester to focus on specific aspects of the code without having to deal with the whole program code all at once.
Static Backward Slicing
A normal (static backward) slice of a program is defined using a set of variable identifiers (V) and a point in the program or line number (i). For example, the slicing criterion ({x,y},25) will result in a slice which only has code that affects the variables x and y up to line 25 in the program.
Static backward slices are valid for any input values. Static backward slices can always be determined absolutely without the program being run.
Dynamic Slicing
Dynamic slicing involves creating a slice of a program based on a specific input. The slice is therefore only valid for its associated input. A dynamic slice criterion consists of V and i, just like a static backward slice. It also contains a sequence of input(s). The structure of a dynamic slice criterion is therefore: (V, i, ).
The criterion ({c},8,<1,3>) will therefore create a dynamic slice with respect to the variable "c" on line 8 with the inputs of 1 and 3 (e.g. for input variables "a" and "b" respectively)
Conditioned Slicing
Conditioned Slicing bridges the gap between static and dynamic slicing. Conditioned Slicing is relevant to a set of initial states rather than just one, as is the case with dynamic slicing. A conditioned slice can therefore act as a typical dynamic slice if just one initial state is specified. At the other end of the scale, a conditioned slice can act as a static slice if all possible initial states are specified.
Amorphous Slicing
Amorphous slicing involves applying changes to the code syntax while preserving the semantics (meaning). This approach can help in understanding certain aspects of the code.
Forward Slicing
In backward slicing, lines of code that do not affect the slicing criterion are removed. With forward slicing, lines that are not AFFECTED by the slicing criterion are removed. It looks forward in the code, relative to the line number specified in the criterion, instead of backwards.
Search for "Program Slicing" on:
Google |
Kelkoo |
Amazon |
eBay (UK) |
eBay (US)
Search for "Program Slicing" on the rest of Computing Students: Program Slicing
|
|
|