Old software is often valuable but hard to change. Rather than throw it away, an organisation can renew it by studying and restructuring it.
Software Re-Engineering
Software re-engineering is the examination, analysis and alteration of an existing system to give it a new form, so that it is easier to maintain and meets present needs. It is cheaper and less risky than writing the system again, because the working logic is kept. It is worth doing when the software is still important but is costly to maintain, when the hardware or the language is obsolete, or when documents are lost. The activities are source code translation to a new language or version, reverse engineering to recover the design, program structure improvement to untangle the control, program modularisation to group related parts, and data re-engineering to clean and convert the data.
Definition: Software re-engineering. The analysis and restructuring of an existing system to reconstitute it in a new form, with the aim of improving its maintainability or adapting it to new needs.
Reverse Engineering
Reverse engineering is the process of analysing a system to identify its components and their relationships, and to create a description of it at a higher level of abstraction. The usual starting point is the source code, or even the executable code, with no documents. The steps are to collect information from the code and the data, to extract the structure, such as call graphs and data structures, to recover the design in the form of structure charts, data flow diagrams and class diagrams, and to recover the specification. Tools help to read the code, to draw the charts and to find the data usage. Reverse engineering does not change the system. It only produces understanding, which is the first step of re-engineering.
Forward Engineering and Restructuring
Forward engineering is the normal movement from requirements to design to code. In the re-engineering cycle, the recovered design is improved by restructuring, which changes the form of the software, such as removing goto statements, without changing its behaviour, and then forward engineering produces the new system from the improved design. The whole sequence of reverse engineering, restructuring and forward engineering is called re-engineering.
Table 4.3: Reverse engineering and re-engineering
| Item | Reverse engineering | Re-engineering |
|---|---|---|
| Aim | Understand and document | Renew the system |
| Changes the system | No | Yes |
| Output | Design and specification | New, improved system |
| Direction | From code to design | Code to design to new code |
Example 4.3: Deciding to re-engineer
Problem: A 15-year-old billing system in an obsolete language still works correctly. It costs 40 person-months a year to maintain, and rewriting it would cost 300 person-months. Re-engineering would cost 120 person-months and cut maintenance to 15 person-months a year. Which option is better over 5 years?
Solution:
- Keeping the system costs 5 × 40 = 200 person-months.
- Re-engineering costs 120 + 5 × 15 = 195 person-months.
- A rewrite costs at least 300 person-months.
Result: Re-engineering is slightly cheaper than keeping it, and far cheaper than rewriting, and it also gives a modern system.
keep = 5 * 40
reeng = 120 + 5 * 15
print(keep, reeng, 300)
Output
200 195 300
Common mistakes
- Confusing reverse engineering, which only recovers the design, with re-engineering, which produces a new system.
- Re-engineering a system that is no longer of value.
- Changing the behaviour of the system during restructuring.
Key takeaways
- Re-engineering renews an existing system.
- Reverse engineering recovers the design from the code.
- Restructuring changes the form but not the behaviour.
- Forward engineering builds the new system from the improved design.
Practice questions
- What is reverse engineering?
- When is re-engineering worthwhile?
- What is restructuring?
Answers to the practice questions
- Analysing a system to recover its design or specification at a higher level of abstraction.
- When the software is still valuable but is costly to maintain or uses obsolete technology.
- Changing the form of the software without changing its behaviour.
Sources
- Official BCA syllabus Advanced Software Engineering, course code 25BCA405DS01, Unit IV
