What’s program slicing?

Print anything with Printful



Program slicing is a method of extracting major elements from complicated code to identify potential bugs and make software more efficient. There are two approaches: semantic, which allows discretion in keeping extra code, and syntactic, which removes everything not essential to the main function. Amorphous program slicing preserves semantic constraints.

In software applications, program slicing is a method of identifying the major elements of a software program and gently extracting them from the more complicated code that makes the program work. This is especially important for software engineering efforts, as it allows the software engineer to find his way through complicated strings of code to access the source code that actually drives the application. Being able to extract these subroutines and view the source code makes it possible to identify a wide range of potential bugs and thus make the software work more efficiently.

It’s not uncommon for the code to be intentionally complicated. One of the main reasons for this action is that the more complicated parts of the code help protect the source code from corruption by viruses and hacking attempts. Usually, a programmer adds a lot of extra code which essentially makes it necessary to go through a number of extra steps to accomplish what could be handled by source code with just a few steps. While this is a desirable state from the point of view of protecting the software from possible corruption, there are situations where access to the source code is needed. This is where program slicing comes into play.

There are two basic approaches or dimensions to programming slicing. The semantic dimension focuses on the elements of the code string that are needed and therefore will be kept. Both static and dynamic functions are identified and preserved making use of specific slicing methods that leave the essentials but remove much of the code inserted as part of the slicing process. With semantic program slicing, the engineer has a fair amount of discretion in deciding what, if any, of the extra code actually remains.

Syntactic program slicing does not give the engineer the same amount of options. With this approach, everything that is not essential to the main function of the code is removed. If a string is found to have no real purpose and has no impact on the semantics of interest found in the code, go. This approach helps preserve the original syntax of the program without any additional frills.

A second increasingly common use of syntactic program slicing is known as amorphous program slicing. With this approach, the goal is to allow the slice to continue working with any syntactic functions that help maintain the semantic constraints that the engineer wishes to preserve in the code.




Protect your devices with Threat Protection by NordVPN


Skip to content