0% found this document useful (0 votes)
10 views4 pages

SRE Ass#2

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 4

Lahore Garrison University

Submitted To:
Sir Shahrukh
Submitted By:
Muhammad Huzaifa Fa-19/BSSE/219
Subject:
Software Re-Engineering

Assignment # 2:

<----------------->
Q#1: What do you understand by the term program comprehension?
Ans: Program Comprehension is the process of gaining new or regaining lost
knowledge about a computer program. Good program comprehension is key to
providing effective software maintenance and effective evolution of software. To
understand the role of program comprehension, consider five kinds of tasks associated
with program maintenance.

Table 1: Tasks and activity requiring code understanding

Maintenance Tasks Activities

Adaptive Understand system


Define adaptive requirements
Code changes
Debug
Regression test
Perfective Understand system
Develop preliminary and detailed perfective design
Code changes/additions
Debug
Regression test
Corrective Understand system
Repair code
Regression test
Reuse Understand problem
Locate components
Integrate components
Code Coverage Understand problem
Find solution based on predefined components
Obtain and modify predefined components
Integrate modified components
Q#2: What is the goal of code cognition?
Ans: The goal of code congition are given below;
 A code maintainer tries to understand a program with a specific goal in mind.
e.g Debugging a program to detect the cause of a known failure.
 Identifying the goal can help in defining the scope of program comprehension.
 Scope of program comprehension: complete program or part of a program
 A program comprehension process is a sequence of activities that use existing
knowledge about the program to generate new knowledge about it.

Q#3: What is mental model? Briefly elaborate the elements that comes under mental
model?

Ans: A mental model describes a programmer’s mental representation of the program


being comprehended. A mental model of a program is not unique; different
programmers view and interpret a programmer in different ways.
A programmer develops a mental model by identifying both Static and dynamic
elements of the program.
Static elements of a mental model
1. Text- structures
 Code and its structure are known as Text-structures.
 It is useful in gaining control flow knowledge in program understanding.
 Understanding test-structures is the beginning of program comprehension.
2. Chunks
 A program chunk is a block of related code segment.
 Chunks enable programmers to create higher level abstractions from
lower-level abstractions.
3. Schemas
 Schemas are generic knowledge structures that guide the programmer’s
interpretations, inferences, expectations and attentions when passage are
comprehended.
 The concept of programming plans correspond to the notion of schemas.
4. Plans
 A knowledge element is anything that is useful in understanding a
program.
 Plans are broad kinds of knowledge elements used by programmer’s.
5. Hypotheses
 As programmer’s start reading code and the related documents, they start
developing an understanding of the program to varying degrees.
 Programmer’s can tests the results of their understanding as conjectures.
 A conjectures may not be completely correct.
Dynamic elements of a mental model
1. Chunking
 In a program, the lowest level of chunks are code segments.
 To understand a program in terms of its higher-level functionalities, a
programmer creates a higher-level abstraction structures by combining
lower level chunks.
 This process of creating a higher-level chunks is called chunking.
2. Cross-referencing
 Cross-referencing means being able to link elements of different
abstraction levels.
 This help in building a mental model of the program.
3. Strategies
 A strategy is a planned sequence of actions to reach a specific goal.
 A strategy is formulated by identifying actions to achieve a goal.

You might also like