Content deleted Content added
m Simplified hatnote syntax |
Importing Wikidata short description: "Set of software engineering methods" |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 1:
{{Short description|Set of software engineering methods}}
{{other uses of|slicing|Slicing (disambiguation)}}
{{more footnotes|date=August 2012}}
Line 4 ⟶ 5:
In [[computer programming]], '''program slicing''' is the computation of the set of program statements, the '''program slice''', that may affect the values at some point of interest, referred to as a '''slicing criterion'''. Program slicing can be used in [[debugging]] to locate source of errors more easily. Other applications of slicing include [[software maintenance]], [[Optimization (computer science)|optimization]], [[Program analysis (computer science)|program analysis]], and [[Non-interference (security)|information flow control]].
Slicing techniques have been seeing a rapid development since the original definition by [[Mark Weiser]]. At first, slicing was only static, i.e., applied on the source code with no other information than the source code. [[Bogdan Korel]] and [[Janusz Laski]] introduced ''dynamic slicing'', which works on a specific execution of the program (for a given execution trace).<ref>{{cite journal |last1=Korel |first1=Bogdan |last2=Laski |first2=Janusz |title=Dynamic Program Slicing |journal=Information Processing Letters |date=1988 |volume=29 |issue=3 |pages=155–163 |doi=10.1016/0020-0190(88)90054-3 |citeseerx=10.1.1.158.9078 }}</ref> Other forms of slicing exist, for instance path slicing.<ref>{{Cite book|
== Static slicing ==
Line 14 ⟶ 15:
For example, consider the C program below. Let's compute the slice for ( write(sum), sum ). The value of sum is directly affected by the statements "sum = sum + i + w" if N>1 and "int sum = 0" if N <= 1. So, slice( write(sum), sum) is the union of three slices and the "int sum = 0" statement which has no dependencies:
<ol>
<li>slice( sum = sum + i + w, sum),</li>
<li>slice( sum = sum + i + w, i),</li>
<li>slice( sum = sum + i + w, w), and</li>
<li>{ int sum=0 }.</li>
</ol>
Line 50 ⟶ 51:
== Lightweight forward static slicing approach ==
A very fast and scalable, yet slightly less accurate, slicing approach is extremely useful for a number of reasons. Developers will have a very low cost and practical means to estimate the impact of a change within minutes versus days. This is very important for planning the implementation of new features and understanding how a change is related to other parts of the system. It will also provide an inexpensive test to determine if a full, more expensive, analysis of the system is warranted. A fast slicing approach will open up new avenues of research in metrics and the mining of histories based on slicing. That is, slicing can now be conducted on very large systems and on entire version histories in very practical time frames. This opens the door to a number of experiments and empirical investigations previously too costly to undertake.<ref>{{Cite journal|
== Dynamic slicing ==
An example to clarify the difference between static and dynamic slicing. Consider a small piece of a program unit, in which there is an iteration block containing an if-else block. There are a few statements in both the <code>if</code> and <code>else</code> blocks that have an effect on a variable. In the case of static slicing, since the whole program unit is looked at irrespective of a particular execution of the program, the affected statements in both blocks would be included in the slice. But, in the case of dynamic slicing we consider a particular execution of the program, wherein the <code>if</code> block gets executed and the affected statements in the <code>else</code> block do not get executed. So, that is why in this particular execution case, the dynamic slice would contain only the statements in the <code>if</code> block.
Line 86 ⟶ 87:
* [http://www.cs.wisc.edu/wpis/html/ Wisconsin Program-Slicing Project]
{{Program analysis}}
[[Category:Debugging]]
[[Category:Program analysis]]
|