SOFTWARE REENGINEERING
SOFTWARE EVOLUTION AND
          REENGINEERING
                     Choiru Za’in
                        2010
Terminology
• Legacy System :
  old method, technology, computer system,
  or application program that continues to be
  used, typically because it still functions for the
  users' needs, even though newer technology
  or more efficient methods of performing a
  task are now available
  .
                                                       2
Overview
•   Software Evolution
•   Software Maintenance
•   Evolution Process
•   Legacy System
•   Reengineering
                           3
Objectives
• To explain why change is inevitable if software
  systems are remain useful
• To discuss software maintenance and
  maintenance cost factors
• To describe the processes involved in software
  evolution
• To discuss an approach to assessing evolution
  strategies for legacy systems
                                                4
Software Change
• Software change is inevitable
  – New requirements emerge when the software is used
  – The business environment changes
  – Errors must be repaired
  – New computers and equipment is added to the system
  – The performance or reliability of the system may have to
    be improved
• A key problem for organizations are implementing
  and managing change to their existing software
  systems.
                                                               5
Software Evolution
• Organizations have huge investments in their
  software systems – they are critical business
  assets.
• To maintain the value of these assets to the
  business, they must be changed and updated.
• The majority of the software budget in large
  companies is devoted to evolving existing
  software rather than developing new hardware.
                                              6
Lehman’s Law of Software Evolution
• The behaviour evolution of software
  – Continuing Change
  – Increasing Complexity
  – Large Program Evolution
  – Invariant Work-Rate
  – Conservation of Familiarity
  – Continuing Growth
  – Declining Quality
  – Feedback System
                                        7
Spiral Model Evolution
          Specification            Implemention
                          Star t
                Release 1
           Operation                Validation
                Release 2
                Release 3
                                                  8
Program evolution dynamics
• Program evolution dynamics is the study of the
  processes of system change.
• After major empirical studies, Lehman and
  Belady proposed that there were a number of
  ‘laws’ which applied to all systems as they
  evolved.
• There are sensible observations rather than
  laws. They are applicable to large systems
  developed by large organisations. Perhaps less
  applicable in other cases.
                                                   9
Lehman’s Laws
   Law                        Description
   Continuing change          A program that is used in a real-world environment necessarily
                              must change or become progressively less useful in that
                              environment.
   Increasing complexity      As an evolving program changes, its structure tends to become
                              more complex. Extra resources must be devoted to preserving
                              and simplifying the structure.
   Large program evolution    Program evolution is a self-regulating process. System
                              attributes such as size, time between releases and the number of
                              reported errors is approximately invariant for each system
                              release.
   Organisational stability   Over a program’s lifetime, its rate of development is
                              approximately constant and independent of the resources
                              devoted to system development.
   Conservation of            Over the lifetime of a system, the incremental change in each
   familiarity                release is approximately constant.
   Continuing growth          The functionality offered by systems has to continually increase
                              to maintain user satisfaction.
   Declining quality          The quality of systems will appear to be declining unless they
                              are adapted to changes in their operational environment.
   Feedback system            Evolution processes incorporate multi-agent, multi-loop
                              feedback systems and you have to treat them as feedback
                              systems to achieve significant product improvement.
                                                                                                 10
Softaware maintenance
• Modifying a program after it has been put into
  use.
• Maintenance does not normally involve major
  changes to the system’s architecture.
• Changes are implemented by modifying
  existing components and adding new
  components to the system.
                                               11
Maintenance is inevitable
• The system requirements are likely to change
  while the system is being developed because
  the environment is changing. Therefore a
  delivered system won't meet its requirements!
• Systems are tightly coupled with their environment. When a
  system is installed in an
  environment it changes that environment and
  therefore changes the system requirements.
• Systems MUST be maintained therefore if they
  are to remain useful in an environment.
Type of maintenance
• Maintenance to repair software faults
   – Changing a system to correct deficiencies in the way meets
     its requirements.
• Maintenance to adapt software to a different operating
  environment
   – Changing a system so that it operates in a different
     environment (computer, OS, etc.) from its initial
     implementation.
• Maintenance to add to or modify the system’s functionality
   – Modifying the system to satisfy new requirements.
                                                             13
Maintenance effort distribution
             Fault repair
               (17%)
                            Functionality
         Software
                             addition or
        adaptation
                            modification
          (18%)
                               (65%)
                                            14
      System evolution vs decline
• Is the cost of maintenance too high?
• Is the system reliability unacceptable?
• Can the system adapt to further change, and within a
  reasonable amount of time?
• Is the system performance still beyond prescribed
  constraints?
• Are system function of limited usefulness?
• Can other system do the same job better, faster, cheaper?
• Is the cost of maintaining the hardware great enough to
  justify replacing it with cheaper, newer hardware?
                                                          15
   Maintenance team responsibilities
• Understanding the system         • Locating and correcting faults
• Locating information system      • Answering questions about the
  documentation                      way the system works
• Keeping system documentation     • Restructuring design and code
  up to date                         components
• Extending existing function to   • Rewriting design and code
  accommodate new or changing        components
  requirements                     • Deleting design and code
• Adding new function to the         components that are no longer
  system                             useful
• Finding the source of system     • Managing changes to the system
  failures or problem s              as they are made
                                                               16
Maintenance Problem
• Staff problem
  – Limited understanding
  – Management priorities
  – Morale
• Technical problem
  – Artifacts and paradigms
  – Testing difficulties
                              17
Factors affecting maintenance effort
•   Application type
•   System novelty
•   Turnover and maintenance staff ability
•   System life span
•   Dependence on changing environment
•   Hardware characteristics
•   Design quality
•   Code quality
•   Documentation quality
•   Testing quality
                                             18
   Measuring maintainability
• Necessary data :                       • Desirable data :
   – Time at which problem is reported      – Ratio of total change
   – Time lost due to administrative          implementation time to total
     delay                                    number of change implemented
   – Time required to analyze problem       – Number unresolved problem
   – Time required to specify which         – Time spent on unresolved
     changes are to be made                   problems
   – Time needed to make the change
                                            – Percentage of changes that
   – Time needed to test the change           introduce new faults
   – Time needed to documented the
                                            – Number of components
     change
                                              modified to implement a change
                                                                       19
Maintenance costs
• Usually greater than development costs (2* to
  100* depending on the application).
• Affected by both technical and non-technical
  factors.
• Increases as software is maintained.
  Maintenance corrupts the software structure so
  makes further maintenance more difficult.
• Ageing software can have high support costs
  (e.g. old languages, compilers etc.).
                                                   20
Development/maintenance costs
System 1
System 2
                                                                    450         $
           0   50   1 00   15 0    200   2 50   3 00   35 0   400         500
   Development costs              Maintenance costs
                                                                                    21
Maintenance cost factors
• Team stability
   – Maintenance costs are reduced if the same staff are involved with
     them for some time
• Contractual responsibility
   – The developers of a system may have no contractual responsibility for
     maintenance so there is no incentive to design for future change.
• Staff skills
   – Maintenance staff are often inexperienced and have limited domain
     knowledge.
• Program age and structure
   – As programs age, their structure is degraded and they become harder
     to understand and change
                                                                         22
Modeling Maintenance Effort (1)
• Belady and Lehman equation:
  1. " M = p + K^(c-d)
     • M ... total maintenance effort,
     • p ... productive efforts,
     • c ... complexity caused by lack of structured design and
       documentation,
     • d ... c reduced by d, the degreee to which the
       maintenance team is familiar with the software
     • K ... empirical constant determined by comparing this
       model with the effort relationships on actual p
                                                              23
      COCOMO II – Software Understanding
      Rating Scale for software understanding increment SU
                               Very Low                     Low                     Nominal                       High                       Very High
                                                                                                                                                             Very Low Cohesion,        Moderately low             Reasonably well             High Cohesion,               Strong modularity
Structure              High Coupling,            cohesion, high             structured, some weak       Low coupling                 Information hiding in
                       Spaghetti Code            coupling                   areas                                                    data and control
                                                                                                                                     structures                                                                                                                                      
                       No match between          Some correlation           Moderate correlation        Good correlation bet         Clear match between
                       program and               between program and        between program             ween program and             program and
Application clarity    application world         application                and application             application                  application world
                       views                                                                                                         views                                                                                                                                      
                       Obscure code; docu        Some code commenta         Moderate level of           Good code commenta           Self descriptive code;
Self descriptiveness   mentation missing         ry and headers; some       code commentary,            ry and headers; useful       documentation upto
                       Obscure or obsolete       useful documentation       headers,                    documentation; some          date, well organized
                                                                            Documentation               weak areas                   with design rationale                                                                                                                                      
SU increment                      50                           40                      30                             20                          10
                                                                                                                                                       24
Maintenance prediction
• Maintenance prediction is concerned with
  assessing which parts of the system may cause
  problems and have high maintenance costs
  – Change acceptance depends on the maintainability of
    the components affected by the change;
  – Implementing changes degrades the system and
    reduces its maintainability;
  – Maintenance costs depend on the number of
    changes and costs of change depend on
    maintainability.
                                                      25
Maintenance prediction
                                                                    What par ts of the system
                                                                    will be the most expensive
  What parts of the system are                                              to maintain?
  most likely to be affected by
       change requests?
                                              Predicting
                                             maintainability
                                                                              What will be the lifetime
                                                                              maintenance costs of this
                                  Predicting system    Predicting                     system?
                                       changes        maintenance
                                                          costs
                                                                           What will be the costs of
         How many change                                                   maintaining this system
          requests can be                                                    over the next year?
             expected?
                                                                                                          26
Change prediction
• Predicting the number of changes requires and understanding
  of the relationships between a system and its environment.
• Tightly coupled systems require changes whenever the
  environment is changed.
• Factors influencing this relationship are
   – Number and complexity of system interfaces;
   – Number of inherently volatile system requirements;
   – The business processes where the system is used.
Complexity metrics
• Predictions of maintainability can be made by assessing the
  complexity of system components.
• Studies have shown that most maintenance effort is spent on
  a relatively small number of system components.
• Complexity depends on
   – Complexity of control structures;
   – Complexity of data structures;
   – Object, method (procedure) and module size.
Process metrics
• Process measurements may be used to assess
  maintainability
   – Number of requests for corrective maintenance;
   – Average time required for impact analysis;
   – Average time taken to implement a change
     request;
   – Number of outstanding change requests.
• If any or all of these is increasing, this may
  indicate a decline in maintainability.
Evolution processes
• Evolution processes depend on
  – The type of software being maintained;
  – The development processes used;
  – The skills and experience of the people involved.
• Proposals for change are the driver for system
  evolution. Change identification and evolution
  continue throughout the system lifetime.
Change identification and evolution
                 Change identification
                      process
    New system                           Change proposals
                  Software evolution
                       process
The system evolution process
   Change      Impact       Release          Change        System
  requests    analysis      planning     implementa tion   release
                             Platform       System
             Fault repair
                            adaptation   enhancement
Change implementation
 Proposed   Requirements   Requirements     Software
  changes     anal ysis      upda ting    de velopment
Urgent change requests
• Urgent changes may have to be implemented
  without going through all stages of the
  software engineering process
  – If a serious system fault has to be repaired;
  – If changes to the system’s environment (e.g. an OS
    upgrade) have unexpected effects;
  – If there are business changes that require a very
    rapid response (e.g. the release of a competing
    product).
Emergency repair
Change       Analyse        Modify      Deliver modified
requests   source code   sour ce code        system
System re-engineering
• 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.
Advantages of reengineering
• 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.
Forward and re-engineering
       System                 Design and            New
     specification          implementation         system
Forward eng ineering
        Existing           Understanding and   Re-eng ineer ed
   softw are system         transf ormation        system
Software re-eng ineering
The re-engineering process
  Original                       Program       Modularised          Original data
  program                     documentation     program
                 Reverse
               eng ineering
                                                            Data
Source code                     Program                re-eng ineering
 translation                  modularisation
                 Prog ram
                 structure
               improvement
                                Structured             Re-engineered
                                 prog ram                   data
Reengineering process activities
• Source code translation
   – Convert code to a new language.
• Reverse engineering
   – Analyse the program to understand it;
• Program structure improvement
   – Restructure automatically for understandability;
• Program modularisation
   – Reorganise the program structure;
• Data reengineering
   – Clean-up and restructure system data.
Re-engineering approaches
           Automa ted pr og ram                Pro gram and da ta
              restructuring                       restructuring
Automated sour ce           Automa ted restructuring         Restructuring plus
 code con version            with man ual changes          architectur al changes
                                                                Increased cost
Reengineering cost factors
• The quality of the software to be
  reengineered.
• The tool support available for reengineering.
• The extent of the data conversion which is
  required.
• The availability of expert staff for
  reengineering.
  – This can be a problem with old systems based on
    technology that is no longer widely used.
Legacy system evolution
• Organisations that rely on legacy systems must choose a
  strategy for evolving these systems
   – Scrap the system completely and modify business processes so that it
     is no longer required;
   – Continue maintaining the system;
   – Transform the system by re-engineering to improve its maintainability;
   – Replace the system with a new system.
• The strategy chosen should depend on the system quality and
  its business value.
System quality and business value
          High business value
                                        High business value
          Low quality
                                        High quality
      9
             10                                      8
                                         6
                                                 7
          Low business value                             Low business value
          Low quality                                    High quality
                  2                                      5
             1         3                     4
                       System quality
Legacy system categories
• Low quality, low business value
   – These systems should be scrapped.
• Low-quality, high-business value
   – These make an important business contribution but are expensive to
     maintain. Should be re-engineered or replaced if a suitable system is
     available.
• High-quality, low-business value
   – Replace with COTS, scrap completely or maintain.
• High-quality, high business value
   – Continue in operation using normal system maintenance.
Business value assessment
• Assessment should take different viewpoints
  into account
  – System end-users;
  – Business customers;
  – Line managers;
  – IT managers;
  – Senior managers.
• Interview different stakeholders and collate
  results.
System quality assessment
• Business process assessment
  – How well does the business process support the
    current goals of the business?
• Environment assessment
  – How effective is the system’s environment and
    how expensive is it to maintain?
• Application assessment
  – What is the quality of the application software
    system?
Business process assessment
• Use a viewpoint-oriented approach and seek answers from
  system stakeholders
   – Is there a defined process model and is it followed?
   – Do different parts of the organisation use different processes for the
     same function?
   – How has the process been adapted?
   – What are the relationships with other business processes and are
     these necessary?
   – Is the process effectively supported by the legacy application
     software?
• Example - a travel ordering system may have a low business
  value because of the widespread use of web-based ordering.
Environment assessment 1
  Factor         Questions
  Supplier       Is the supplier is still in existence? Is the supplier financially
  stability      stable and likely to continue in existence? If the supplier is
                 no longer in business, does someone else maintain the
                 systems?
  Failure rate   Does the hardware have a high rate of reported failures?
                 Does the support software crash and force system restarts?
  Age            How old is the hardware and software? The older the
                 hardware and support software, the more obsolete it will be.
                 It may still function correctly but there could be significant
                 economic and business benefits to moving to more modern
                 systems.
  Performance Is the performance of the system adequate? Do performance
              problems have a significant effect on system users?
Environment assessment 2
 Support            What local support is required by the hardware and
 requirements       software? If there are high costs associated with this support,
                    it may be worth considering system replacement.
 Maintenance        What are the costs of hardware maintenance and support
 costs              software licences? Older hardware may have higher
                    maintenance costs than modern systems. Support software
                    may have high annual licensing costs.
 Interoperability   Are there problems interfacing the system to other systems?
                    Can compilers etc. be used with current versions of the
                    operating system? Is hardware emulation required?
Application assessment 1
  Factor              Questions
  Understandability   How difficult is it to understand the source code of the
                      current system? How complex are the control structures
                      that are used? Do variables have meaningful names that
                      reflect their function?
  Documentation       What system documentation is available? Is the
                      documentation complete, consistent and up-to-date?
  Data                 Is there an explicit data model for the system? To what
                      extent is data duplicated in different files? Is the data used
                      by the system up-to-date and consistent?
  Performance         Is the performance of the application adequate? Do
                      performance problems have a significant effect on system
                      users?
Application assessment 2
 Programming        Are modern compilers available for the programming
 language           language used to develop the system? Is the programming
                    language still used for new system development?
 Configuration      Are all versions of all parts of the system managed by a
 management         configuration management system? Is there an explicit
                    description of the versions of components that are used in
                    the current system?
 Test data          Does test data for the system exist? Is there a record of
                    regression tests carried out when new features have been
                    added to the system?
 Personnel skills   Are there people available who have the skills to maintain
                    the application? Are there only a limit ed number of people
                    who understand the system?
System measurement
• You may collect quantitative data to make an
  assessment of the quality of the application
  system
  – The number of system change requests;
  – The number of different user interfaces used by
    the system;
  – The volume of data used by the system.
Key points
• Software development and evolution should
  be a single iterative process.
• Lehman’s Laws describe a number of insights
  into system evolution.
• Three types of maintenance are bug fixing,
  modifying software for a new environment
  and implementing new requirements.
• For custom systems, maintenance costs
  usually exceed development costs.
Key points
• The process of evolution is driven by requests
  for changes from system stakeholders.
• Software re-engineering is concerned with re-
  structuring and re-documenting software to
  make it easier to change.
• The business value of a legacy system and its
  quality should determine the evolution
  strategy that is used.