You are on page 1of 17

0721421 - Software Reengineering

Dr. Said Ghoul,


Professor

Philadelphia University

Copyright © Prof. S. Ghoul (2019)


Part 2. Software Comprehension
Shared with Prof. Suzanne M. Embury, University of Manchester, UK
http://intranet.cs.man.ac.uk/Study_subweb/Ugrad/coursenotes/CS3331/lectures.php#22

Copyright © Prof. S. Ghoul (2019)


Chapter 3

Code reading

Content
 Introduction
 Bottom-Up Strategy
 Top-Down Strategy

Copyright © Prof. S. Ghoul (2019)


Code Reading

Copyright © Prof. S. Ghoul (2019)


Code Reading

Copyright © Prof. S. Ghoul (2019)


Code Reading

Why

What
How

What

How
Copyright © Prof. S. Ghoul (2019)
Code Reading

Example : How  What  Why

SumAr (A, N, Res)


{
int I;

I = 1; Res  0;
While I <= N do
{ Res  Res + A[I];
I  I + I + ‘1;
}
}// end SumAr

Copyright © Prof. S. Ghoul (2019)


Code Reading
Bottom-Up Strategy

Copyright © Prof. S. Ghoul (2019)


Code Reading

Copyright © Prof. S. Ghoul (2019)


Code Reading

Copyright © Prof. S. Ghoul (2019)


Code Reading

Copyright © Prof. S. Ghoul (2019)


Code Reading
Top-Down Strategy

Copyright © Prof. S. Ghoul (2019)


Code Reading
Top-Down Strategy

Copyright © Prof. S. Ghoul (2019)


Code Reading
Top-Down Strategy

Copyright © Prof. S. Ghoul (2019)


Code Reading
Top-Down Strategy

Copyright © Prof. S. Ghoul (2019)


Code Reading
Top-Down Strategy

Try it by yourself

SumAr (A, N, Res) // Sum of array elements


{
int I;

I = 1; Res  0;
While I <= N do
{ Res  Res + A[I];
I  I + I + ‘1;
}
}// end SumAr

Copyright © Prof. S. Ghoul (2019)


Code Reading

End

Copyright © Prof. S. Ghoul (2019)

You might also like