
Code Comprehension Techniques and Tools
Understand the importance of program comprehension in software maintenance, including the cognitive processes involved, influence factors, analysis techniques, and tools used. Expertise and cross-referencing are highlighted as key elements for efficient program comprehension. Explore the strategies and methods to enhance understanding and maintain software systems effectively.
Uploaded on | 0 Views
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Information Maintenance Program Comprehension 3IT
Program comprehension 50 % to 90 % of the time in software maintenance is consumed Program comprehension is that activity by which software engineers come to an understanding of the behavior of a software system using the source code as the primary reference. Program comprehension model
Program comprehension Program comprehension, also sometimes referred to as program understanding or code comprehension, is a fundamental aspect of software maintenance. It essentially refers to the cognitive processes involved in understanding source code. Influence factors on program comprehension (understanding) Domain knowledge Programming expertise Implementation issues : Naming style , Comments Documentation Program organization and presentation : control flow , visual enhancement of source code Comprehension support tools
Program analysis techniques
Program analysis techniques Static Analysis Dynamic Analysis Does not required program to be executed Starts the analysis from the source code Less precise Do not support run-time programming language features Experiences less overheads requires program to be executed Starts the analysis from the execution results More precise Supports run-time programming language features Experiences large run-time overheads Program analysis refers to any examination of source code that attempts to find patterns or differences thought to reveal specific behaviours of the software.
Tools used in code comprehension 1- Expertise It is proven that expertise matters a lot in quick and accurate program comprehension. Well knowledge of problem domain, problem solving and programming languages make the program comprehension easier 2-Cross referencing Cross referencing is used as a tool for general understandability of the source code. During s,w comprehension activities the maintainer often has to jump to and from the definition and use of different program identifier. Cross reference support is used to provide the linkage between identifier s definition and its use at different places in the source code ,The information gathered through cross referencing can be use to draw different code overview diagrams, which can help to determine the dependencies between different source files
3- Call graphs The Call graphs are used to represent inter procedural communication in a source code. It also describes the information about the data used within a procedure and global data shared by different procedure. Two commonly used types of call graphs are static and dynamic call graphs. Static call graphs show the potential calls while the dynamic call graphs show the calls that can occur on a particular execution of a program. Static and dynamic call graphs may be used in static and dynamic program analysis.
4- Data Flow Analysis Considered static and dynamic method In Data Flow Analysis it is customary to think of a program as a graph: the nodes are the elementary blocks and the edges describe how control might pass from one elementary block to another. Illustrate the flow graph (Data flow analysis) for the factorial program X!
5- Comments and Annotations Traditional comments in the source code are usually helpful for the code comprehension. But often the comments are outdated or incomplete to show the proper meaning of the source code. Annotation is another way to help the maintainer to comprehend the code easily. you can use comments to describe the purpose or logic of a code block, and you can use annotations to assign names or descriptions to inputs, outputs, or variables. 6-Control Flow Analysis The purpose of Control Flow Analysis is to determine information about what "elementary blocks" may lead to what other "elementary blocks".
7-Program slicing Program slicing is a technique used to analyse and understand the behaviour of a program by extracting relevant portions of code that directly contribute to a specific computation or behaviour. Given a program and a specific criterion (e.g., a variable's value at a certain point), program slicing identifies and extracts the subset of the program's code that directly affects the criterion. Program slicing helps in understanding program dependencies, identifying bugs, debugging, and program comprehension. There are two main types of program slicing: Forward Slicing: Focuses on extracting the portion of the program that influences a specific variable or computation forward in the program execution. Backward Slicing: Identifies the portion of the program that is influenced by a specific variable or computation backward in the program execution. Program slicing can be performed statically (without executing the program) or dynamically (during program execution).
program slicing focuses on extracting relevant portions of code to understand specific behaviors or computations within the program. Both techniques are valuable for software development, analysis, and maintenance. 8-Program Decomposition Program decomposition used to understand program ( for maintenance purpose or for collaborating , use efficiently when design and implement program ) involves breaking down a complex program into smaller, more manageable modules or components. This process aims to simplify the overall structure of the program, making it easier to understand, develop, and maintain. Decomposition can occur at various levels of abstraction, ranging from high-level modules down to individual functions or classes. Decomposition helps in organizing code logically, improving code reuse, and facilitating collaborative development. Common techniques for program decomposition include modularization, encapsulation, abstraction, and separation of concerns.
program decomposition aims to break down a program into smaller components for better organization and manageability,