chapter 5: software re-engineering omar meqdadi se 3860 lecture 5 department of computer science and...

34
Chapter 5: Software Re- Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

Upload: hope-adams

Post on 14-Jan-2016

224 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

Chapter 5: Software

Re-Engineering

Omar MeqdadiSE 3860 Lecture 5

Department of Computer Science and Software Engineering University of Wisconsin-Platteville

Page 2: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

2

Topic Covered

Software Re-engineering Life-Cycle of Software Re-engineering Reverse Engineering Software Re-engineering Process

Page 3: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

3

Definitions

Forward Engineering is the traditional process of moving from high-level abstractions and logical, implementation-independent designs to the physical implementation of a system.

Reverse Engineering is the process of analyzing a subject system to

Identify the system's components and their interrelationships and

Create representations of the system in another form or a higher level of abstraction.

Page 4: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

4

Definitions

Reengineering - Reorganising and modifying existing software systems to make them more maintainable by first reverse engineering and then forward engineering

Refactoring - A program restructuring (rearranging) in a series of small, semantics preserving transformations in order to make the code easier to maintain and modify

Page 5: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

Forward Engineering Reverse Engineering

Requirements

Analysis

Design

Implementation

Forward Engineering and Reverse Engineering

Page 6: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

6

Forward Engineering and Re-Engineering

Page 7: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

7

System Re-engineering

A Preventive Maintenance activity Re-structuring or re-writing part or all of a legacy system

without changing its functionality Applicable where some but not all sub-systems of a larger

system require frequent maintenance Re-engineering involves adding effort to make them

easier to maintain. The system may be re-structured and re-documented.

Page 8: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

8

When to Re-engineer?

Port to other Platform when hardware or software support becomes obsolete

Design extraction to improve maintainability, portability, etc.

Exploitation of New Technology new language features, standards, libraries, etc. when tools to support restructuring are readily available

Page 9: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

9

Re-engineering Advantages

Reduced risk There is a high risk in new software development. There

may be development problems, staffing problems and specification problems

Reduced cost The cost of re-engineering is often significantly less than

the costs of developing new software

Page 10: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

10

Re-engineering Cost Factors

The quality of the software to be re-engineered The tool support available for re-engineering The extent of the data conversion which is required The availability of expert staff for re-engineering

Page 11: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

11

Re-engineering Cost

Page 12: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

Life-Cycle of Re-engineering

Requirements

Designs

Code

(1) requirementanalysis

(2) modelcapture

(3) problemdetection (4) problem

resolution

(5) program transformation

• people centric• lightweight

Page 13: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

Life-Cycle of Re-engineering

Reverse Engineering Phase Requirement analysis: analyze on which parts of your

requirements have changed Model capture: reverse engineer from the source-code into a more

abstract form, typically some form of a design model

Forwarded Engineering Phase Problem detection: identify design problems in that abstract model Problem resolution: propose an alternative design that will solve

the identified problem Program transformations: make the necessary changes to the

code, so that it adheres to the new design yet preserves all the required functionality

Page 14: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

14

Re-engineering Process Activities

Source code translation Convert code to a new language

Reverse engineering Analyze the program to understand it

Program structure improvement Restructure automatically for understandability

Design recovery and reimplementation Program modularization

Reorganize the program structure

Data reengineering Clean-up and restructure system data

Page 15: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

15

Source Code Translation

Involves converting the code from one language (or language version) to another e.g. FORTRAN to C

May be necessary because of: Hardware platform update Staff skill shortages Organisational policy changes

Only realistic if an automatic translator is available

Page 16: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

16

Source Code Translation

Page 17: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

17

Reverse Engineering

Program Comprehension Analysing existing software with a view to understand its

design and specification Systematic process of acquiring important design factors

and information regarding engineering aspects from an existing product

A process which analyses a product/technology to find out the design aspects and its functions

Builds a program data base and generates information from this

Page 18: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

18

Reverse Engineering Goals

Cope with complexity need techniques to understand large, complex systems

Recover lost information extract what changes have been made and why

Detect side effects help understand ramifications of changes

Synthesize higher abstractions identify latent abstractions in software

Facilitate reuse detect candidate reusable artifacts and components

Page 19: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

19

Reverse Engineering Activities

Understanding process source code is analyzed to at varying levels of detail to understand procedural abstractions and overall

functionality Understanding data

internal data structures database structure

Understanding user interfaces what are basic actions processed by the interface? what is system's behavioral response to these actions?

Page 20: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

20

Reverse Engineering Process

Page 21: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

21

Reverse Engineering Techniques

Re-documentation pretty printers diagram generators cross-reference listing generators

Design recovery software metrics browsers visualization tools static analyzers dynamic (trace) analyzers

Page 22: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

22

Reverse Engineering for Software Maintenance

Corrective maintenance: Easier to identify defective program components and the

source of residual errors

Adaptive/Perfective maintenance: Eases understanding of system’s components and their

interrelationships, showing where new requirements fit and how they relate to existing components

Preventive Maintenance Represent the first phase of the re-engineering process

Page 23: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

23

Code Restructuring (Refactoring)

Maintenance tends to corrupt the structure of a program. It becomes harder and harder to understand

So, the program may be automatically restructured Source code is analyzed and violations of structured

programming practices are noted and repaired Examples:

Remove unconditional branches Conditions may be simplified to make them more readable

Revised code needs to be reviewed and tested

Page 24: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

24

Code Restructuring (Refactoring)

Example1: Spaghetti logic

Page 25: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

25

Code Restructuring (Refactoring)

Example1: Structured control logic

Page 26: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

26

Code Restructuring (Refactoring)

Example2: Condition simplification

-- Complex conditionif not (A > B and (C < D or not ( E > F) ) )...

-- Simplified conditionif (A <= B and (C>= D or E > F)...

Page 27: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

27

Program Modularization

The process of re-organising a program so that related program parts are collected together in a single module

Usually a manual process that is carried out by program inspection and re-organisation

Page 28: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

28

Module Types

Data abstractions Abstract data types where data structures and associated operations are

grouped Hardware modules

All functions required to interface with a hardware unit Functional modules

Modules containing functions that carry out closely related tasks Process support modules

Modules where the functions support a business process or process fragment

Page 29: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

29

Data Re-Engineering

Involves analysing and reorganising the data structures (and sometimes the data values) in a program

Existing data structures are reviewed for quality Integrating and centralizing multiple databases Unifying multiple, inconsistent representations Upgrading data models Objective is to create a managed data environment

Page 30: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

30

Data Problems

End-users want data on their desktop machines rather than in a file system.

Systems may have to process much more data than was originally intended by their designers

Redundant data may be stored in different formats in different places in the system

Data naming problems Names may be hard to understand. The same data may have different

names in different programs

Page 31: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

31

Data Problems

Field length problems The same item may be assigned different lengths in different

programs Record organisation problems

Records representing the same entity may be organised differently in different programs

Hard-coded literals No data dictionary

Page 32: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

32

Data Re-engineering Approaches

Page 33: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

33

Data Re-engineering Process

Page 34: Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

34

Data Conversion

Changing the data structure organisation without changing the data values

Data value conversion is very expensive. Special-purpose programs have to be written to carry out the conversion