1
Object-Oriented and Object-Oriented and Classical Software Classical Software
EngineeringEngineering
2
CHAPTER 15CHAPTER 15
Postdelivery Maintenance
3
ObjectivesObjectives Perform postdelivery maintenancePerform postdelivery maintenance Appreciate the importance of Appreciate the importance of
postdelivery maintenancepostdelivery maintenance Describe the challenges of postdelivery Describe the challenges of postdelivery
maintenancemaintenance Describe the maintenance implications of Describe the maintenance implications of
the object-oriented paradigmthe object-oriented paradigm Describe the skills needed for Describe the skills needed for
maintenancemaintenance
4
OverviewOverview Why maintenance is necessaryWhy maintenance is necessary What is required of maintenance programmersWhat is required of maintenance programmers Maintenance case studyMaintenance case study Management of maintenanceManagement of maintenance Maintenance of object-oriented softwareMaintenance of object-oriented software Maintenance skills versus development skillsMaintenance skills versus development skills Reverse engineeringReverse engineering Testing during the maintenance phaseTesting during the maintenance phase CASE tools for the maintenance phaseCASE tools for the maintenance phase Metrics for the maintenance phaseMetrics for the maintenance phase Challenges of the maintenance phaseChallenges of the maintenance phase
5
Maintenance PhaseMaintenance Phase MaintenanceMaintenance
– AnyAny change to change to anyany component of the component of the product (including documentation) product (including documentation) after it has passed the acceptance testafter it has passed the acceptance test
Why is maintenance necessary?Why is maintenance necessary?– Corrective maintenanceCorrective maintenance– Perfective maintenancePerfective maintenance– Adaptive maintenanceAdaptive maintenance
6
Types of maintenanceTypes of maintenance
7
Types of maintenance Types of maintenance (contd)(contd)
Corrective maintenanceCorrective maintenance– To correct residual faultsTo correct residual faults
Specification, design, implementation, Specification, design, implementation, documentation, or any other types of documentation, or any other types of faultsfaults
– On average, 17.5% of maintenanceOn average, 17.5% of maintenance
8
Types of maintenance Types of maintenance (contd)(contd)
Perfective maintenancePerfective maintenance– Client requests changes to improve product Client requests changes to improve product
effectivenesseffectiveness Add additional functionalityAdd additional functionality Make product run fasterMake product run faster Improve maintainabilityImprove maintainability
– On average, 60.5% of maintenanceOn average, 60.5% of maintenance
9
Types of maintenance Types of maintenance (contd)(contd)
Adaptive maintenanceAdaptive maintenance– Responses to changes in environment Responses to changes in environment
in which product operatesin which product operates Product ported to new compiler, Product ported to new compiler,
operating system, and/or hardwareoperating system, and/or hardware– On average, 18% of maintenanceOn average, 18% of maintenance
10
Difficulty of MaintenanceDifficulty of Maintenance About 67% of the total cost of a About 67% of the total cost of a
product accrues during the product accrues during the maintenance phasemaintenance phase
Maintenance is a major income sourceMaintenance is a major income source Nevertheless, even today many Nevertheless, even today many
organizations assign maintenance to organizations assign maintenance to – Unsupervised beginners, and Unsupervised beginners, and – Less competent programmersLess competent programmers
11
What is Required of What is Required of Maintenance Maintenance
Programmers?Programmers? Maintenance is one of the most difficult aspects of Maintenance is one of the most difficult aspects of
software production becausesoftware production because– Maintenance incorporates aspects of all other phasesMaintenance incorporates aspects of all other phases
Suppose a fault report is handed to a maintenance Suppose a fault report is handed to a maintenance programmerprogrammer
What tools does the maintenance programmer have to What tools does the maintenance programmer have to find the fault?find the fault?– The fault report filed by userThe fault report filed by user– The source codeThe source code– And often nothing elseAnd often nothing else
12
What is Required of What is Required of Maintenance Maintenance
Programmers?Programmers? Maintenance programmer must have superb Maintenance programmer must have superb
debugging skillsdebugging skills– The fault could lie anywhere within the productThe fault could lie anywhere within the product– The original cause of the fault might lie in the by now The original cause of the fault might lie in the by now
non-existent specifications or design documentsnon-existent specifications or design documents
13
Corrective MaintenanceCorrective Maintenance Suppose that the maintenance Suppose that the maintenance
programmer has located the faultprogrammer has located the fault ProblemProblem
– How to fix it without introducing a How to fix it without introducing a regression faultregression fault
Note: Regression Fault? Note: Regression Fault? A A faultfault revealed revealed by a test case that has previously by a test case that has previously passed but no long passes passed but no long passes
14
Corrective Maintenance Corrective Maintenance (contd)(contd)
How to minimize regression faultsHow to minimize regression faults– Consult the detailed documentation for product as a wholeConsult the detailed documentation for product as a whole– Consult the detailed documentation for each individual Consult the detailed documentation for each individual
modulemodule What usually happensWhat usually happens
– There is no documentation at all, or There is no documentation at all, or – The documentation is incomplete, or The documentation is incomplete, or – The documentation is faultyThe documentation is faulty
The programmer must deduce from the source code itself all The programmer must deduce from the source code itself all the information needed to avoid introducing a regression the information needed to avoid introducing a regression faultfault
15
Corrective Maintenance Corrective Maintenance (contd)(contd)
Now the programmer changes the source codeNow the programmer changes the source code Test that the modification works correctlyTest that the modification works correctly
– Use specially constructed test casesUse specially constructed test cases Check for regression faults Check for regression faults
– Use stored test dataUse stored test data Add specially constructed test cases to stored test data for Add specially constructed test cases to stored test data for
future regression testingfuture regression testing Document all changesDocument all changes
16
Corrective Maintenance Corrective Maintenance (contd)(contd)
Major skills required for corrective maintenanceMajor skills required for corrective maintenance– Superb diagnostic skillsSuperb diagnostic skills– Superb testing skillsSuperb testing skills– Superb documentation skillsSuperb documentation skills
17
Adaptive and Perfective Adaptive and Perfective MaintenanceMaintenance
The maintenance programmer must go through the The maintenance programmer must go through the phases of phases of – Requirements Requirements – SpecificationsSpecifications– DesignDesign– Implementation and integrationImplementation and integration
Using the existing product as a starting pointUsing the existing product as a starting point
18
Adaptive and Perfective Adaptive and Perfective Maintenance (contd)Maintenance (contd)
When programs are developedWhen programs are developed– Specifications are produced by specification Specifications are produced by specification
expertsexperts– Designs are produced by design expertsDesigns are produced by design experts– Implementation is performed by implementation Implementation is performed by implementation
expertsexperts– Integration is performed by integration expertsIntegration is performed by integration experts– Testing is performed by testing expertsTesting is performed by testing experts– Documentation is produced by documentation Documentation is produced by documentation
expertsexperts
19
Adaptive and Perfective Adaptive and Perfective Maintenance (contd)Maintenance (contd)
But every maintenance programmer needs to be But every maintenance programmer needs to be an expert inan expert in– SpecificationsSpecifications– DesignDesign– Implementation Implementation – Integration Integration – TestingTesting– DocumentationDocumentation
20
Adaptive and Perfective Adaptive and Perfective Maintenance (contd)Maintenance (contd)
ConclusionConclusion No form of maintenanceNo form of maintenance
– Is a task for an unsupervised Is a task for an unsupervised beginner, orbeginner, or
– Should be done by a less skilled Should be done by a less skilled computer professional computer professional
21
The Rewards of The Rewards of MaintenanceMaintenance
Maintenance is a thankless task in every way Maintenance is a thankless task in every way – Maintainers deal with dissatisfied usersMaintainers deal with dissatisfied users– If the user were happy,the product would not need If the user were happy,the product would not need
maintenancemaintenance– The user’s problems are often caused by the The user’s problems are often caused by the
individuals who developed the product, not the individuals who developed the product, not the maintainermaintainer
– The code itself may be badly writtenThe code itself may be badly written– Maintenance is despised by many software developersMaintenance is despised by many software developers– Unless good maintenance service is provided, the client Unless good maintenance service is provided, the client
will take future development business elsewherewill take future development business elsewhere– Maintenance is the most important phase of software Maintenance is the most important phase of software
production, the most difficult—and most thankless production, the most difficult—and most thankless
22
The Rewards of The Rewards of Maintenance (contd)Maintenance (contd)
How can this situation be How can this situation be changed?changed?
Managers must assign Managers must assign maintenance to their best maintenance to their best programmers, andprogrammers, and
Pay them accordinglyPay them accordingly
23
Maintenance Case StudyMaintenance Case Study Temperate Fruit CommitteeTemperate Fruit Committee Software was developed for exactly 7 temperate Software was developed for exactly 7 temperate
fruits fruits – Apples, apricots, cherries, nectarines, Apples, apricots, cherries, nectarines,
peaches, pears, and plumspeaches, pears, and plums It was extended to include kiwi fruit, with It was extended to include kiwi fruit, with
difficultydifficulty The product now needed to handle 26 additional The product now needed to handle 26 additional
fruitsfruits ““Just to the same thing 26 times?”Just to the same thing 26 times?”
24
Maintenance Case Study Maintenance Case Study (contd)(contd)
Lessons to be learnt from thisLessons to be learnt from this– The problem was caused by the developer, The problem was caused by the developer,
not the maintainernot the maintainer– A maintainer is often responsible for fixing A maintainer is often responsible for fixing
other people’s mistakesother people’s mistakes– The client frequently does not understand that The client frequently does not understand that
maintenance can be difficult, or all but maintenance can be difficult, or all but impossibleimpossible
– All software development activities must be All software development activities must be performed with an eye on future maintenanceperformed with an eye on future maintenance
25
Management of Management of MaintenanceMaintenance
Defect ReportsDefect Reports Authorizing Changes to the Authorizing Changes to the
ProductProduct Ensuring MaintainabilityEnsuring Maintainability Problem of Repeated MaintenanceProblem of Repeated Maintenance
26
Defect ReportsDefect Reports We need a mechanism for changing a productWe need a mechanism for changing a product If the product appears to function incorrectly, the user If the product appears to function incorrectly, the user
files a defect reportfiles a defect report Defect report must include enough information Defect report must include enough information
to enable the maintenance programmer to re-to enable the maintenance programmer to re-create the problem:create the problem:– Sort of software failureSort of software failure– Severity of the defectSeverity of the defect– Typical severity categoriesTypical severity categories
Ideally, every fault should be fixed immediatelyIdeally, every fault should be fixed immediately– In practice, programming organizations usually are In practice, programming organizations usually are
understaffed understaffed – Immediate preliminary investigationImmediate preliminary investigation– If a defect is critical, immediate corrective action If a defect is critical, immediate corrective action
must be takenmust be taken
27
Defect Report (contd)Defect Report (contd) The maintenance programmer The maintenance programmer
should first consult the defect report should first consult the defect report filefile
The file contains all reported faults The file contains all reported faults not yet fixed, and suggestions for not yet fixed, and suggestions for working around themworking around them
If the defect has been reported If the defect has been reported previously , any information should previously , any information should be given to the userbe given to the user
28
Defect Report (contd)Defect Report (contd) If a new defect, maintenance programmer should try If a new defect, maintenance programmer should try
to find to find – Cause of defectCause of defect– A way to fix it A way to fix it – A way to work around problemA way to work around problem
The maintenance programmers’ conclusions should The maintenance programmers’ conclusions should be added to the defect report file, together with be added to the defect report file, together with supporting documentation supporting documentation – ListingsListings– DesignsDesigns– ManualsManuals
29
Management of Management of Maintenance (contd)Maintenance (contd)
The file should also contain the client’s requests for The file should also contain the client’s requests for perfective and adaptive maintenance perfective and adaptive maintenance – Contents of file must be prioritized by the clientContents of file must be prioritized by the client– The next modification is the one with the highest priorityThe next modification is the one with the highest priority
Copies of defect reports must be circulated to all usersCopies of defect reports must be circulated to all users– Including: estimate of when the fault can be fixedIncluding: estimate of when the fault can be fixed
If the same failure occurs at another site, the user can If the same failure occurs at another site, the user can determine determine – If it is possible to work around the fault, and If it is possible to work around the fault, and – How long until it can be fixedHow long until it can be fixed
30
Defect Report (contd)Defect Report (contd) In an ideal worldIn an ideal world
– We fix every fault immediatelyWe fix every fault immediately– Then we distribute the new version of Then we distribute the new version of
product to all sitesproduct to all sites In the real worldIn the real world
– We distribute fault reports to all sitesWe distribute fault reports to all sites– We do not have the staff for instant We do not have the staff for instant
maintenancemaintenance
31
Authorizing Changes to the Authorizing Changes to the ProductProduct
Corrective maintenanceCorrective maintenance– Assign a maintenance programmer to Assign a maintenance programmer to
determine the fault and its cause, then repair determine the fault and its cause, then repair itit
– Test the fix, test the product as a whole Test the fix, test the product as a whole (regression testing)(regression testing)
– Update the documentation to reflect the Update the documentation to reflect the changes madechanges made
– Update the prologue comments to reflectUpdate the prologue comments to reflect Why it was changed, Why it was changed, What was changed,What was changed, By whom, andBy whom, and WhenWhen
32
Authorizing Changes to Authorizing Changes to the Product (contd)the Product (contd)
Adaptive and perfective maintenanceAdaptive and perfective maintenance– As with corrective maintenance, except As with corrective maintenance, except
there is no fault reportthere is no fault report– There is a change in requirements insteadThere is a change in requirements instead
33
Authorizing Changes to Authorizing Changes to the Product (contd)the Product (contd)
What if the programmer has not tested the fix What if the programmer has not tested the fix adequately? adequately? – Before the product is distributed, it must be tested by Before the product is distributed, it must be tested by
the SQA groupthe SQA group Maintenance is extremely hardMaintenance is extremely hard Testing is difficult and time consumingTesting is difficult and time consuming Baselines and private copiesBaselines and private copies
34
Ensuring MaintainabilityEnsuring Maintainability Maintenance is not a one-time effortMaintenance is not a one-time effort We must plan for maintenance over the entire life We must plan for maintenance over the entire life
cyclecycle– Design phase—use information-hiding Design phase—use information-hiding
techniquestechniques– Implementation phase—select variable names Implementation phase—select variable names
meaningful to future maintenance programmersmeaningful to future maintenance programmers– Documentation must be complete and correct, Documentation must be complete and correct,
and reflect current version of every module and reflect current version of every module
35
Ensuring Maintainability Ensuring Maintainability (contd)(contd)
During the maintenance phase, During the maintenance phase, maintainability must not be maintainability must not be compromisedcompromised– Always be conscious of the inevitable Always be conscious of the inevitable
further maintenancefurther maintenance Principles leading to maintainability Principles leading to maintainability
are equally applicable to the are equally applicable to the maintenance phase itself maintenance phase itself
36
The Problem of Repeated The Problem of Repeated MaintenanceMaintenance
Moving target problemMoving target problem– Frustrating to development teamFrustrating to development team– Frequent changes have an adverse effect on the Frequent changes have an adverse effect on the
productproduct Apparent solutionApparent solution
– Construct a rapid prototypeConstruct a rapid prototype– Change it as frequently as the client wantsChange it as frequently as the client wants– Once the client is finally satisfied, the specifications Once the client is finally satisfied, the specifications
are approved and product is constructedare approved and product is constructed In practiceIn practice
– The client can change the requirements next dayThe client can change the requirements next day– If willing to pay the price, the client can change the If willing to pay the price, the client can change the
requirements dailyrequirements daily
37
Problem of Repeated Problem of Repeated Maintenance (contd)Maintenance (contd)
The problem exacerbated during the maintenance The problem exacerbated during the maintenance phasephase
The more changes there areThe more changes there are– The more the product deviates from its original The more the product deviates from its original
designdesign– The more difficult further changes becomeThe more difficult further changes become– Documentation becomes even less reliable than Documentation becomes even less reliable than
usualusual– Regression testing files are not up to dateRegression testing files are not up to date– A total rewrite may be needed for further A total rewrite may be needed for further
maintenance maintenance
38
Moving Target Problem Moving Target Problem (contd)(contd)
Clearly a management problemClearly a management problem In theoryIn theory
– Developers must explain the problem at start Developers must explain the problem at start of the project of the project
– Specifications can be frozen until deliverySpecifications can be frozen until delivery– Specifications can be frozen after perfective Specifications can be frozen after perfective
maintenancemaintenance In practiceIn practice
– It does not work that wayIt does not work that way– A client with clout can order changes and they A client with clout can order changes and they
are implementedare implemented
39
WarningWarning It is no use implementing changes It is no use implementing changes
slowlyslowly The relevant personnel are The relevant personnel are
replacedreplaced Nothing can be done if the person Nothing can be done if the person
calling for repeated change has calling for repeated change has sufficient cloutsufficient clout
40
Maintenance of Object-Maintenance of Object-Oriented SoftwareOriented Software
The object-oriented paradigm promotes maintenanceThe object-oriented paradigm promotes maintenance– The product consists of independent unitsThe product consists of independent units– Encapsulation (conceptual independence)Encapsulation (conceptual independence)– Information hiding (physical independence)Information hiding (physical independence)– Message-passing is the sole communicationMessage-passing is the sole communication
Reality is somewhat different!Reality is somewhat different! Three obstaclesThree obstacles
– The complete inheritance hierarchy can be largeThe complete inheritance hierarchy can be large– The consequences of polymorphism and dynamic The consequences of polymorphism and dynamic
bindingbinding– The consequences of inheritanceThe consequences of inheritance
41
Maintenance versus Maintenance versus Development SkillsDevelopment Skills
Skills needed for maintenance includeSkills needed for maintenance include– Ability to determine cause of failure of large productAbility to determine cause of failure of large product
Also needed during integration and product Also needed during integration and product testingtesting
– Ability to function effectively without adequate Ability to function effectively without adequate documentationdocumentation
Documentation rarely complete until deliveryDocumentation rarely complete until delivery Skills in specification, design, implementation, testingSkills in specification, design, implementation, testing
– All four activities carried out during developmentAll four activities carried out during development Skills needed for maintenance same as those for other Skills needed for maintenance same as those for other
phasesphases
42
Maintenance versus Maintenance versus Development SkillsDevelopment Skills
Key PointKey Point– Maintenance programmers must not merely be skilled in Maintenance programmers must not merely be skilled in
broad variety of areas, they must be broad variety of areas, they must be highlyhighly skilled in skilled in allall those areasthose areas
– Specialization impossible for the maintenance programmerSpecialization impossible for the maintenance programmer Maintenance is the same as development, only more Maintenance is the same as development, only more
soso
43
Reverse EngineeringReverse Engineering Legacy System, that is ,software in Legacy System, that is ,software in
current use but developed some 15 or current use but developed some 15 or 20 years ago20 years ago
Reverse Engineering, one way of Reverse Engineering, one way of handling this problem is to start with handling this problem is to start with the source code and attempt to re-the source code and attempt to re-create the design documents or even create the design documents or even the specifications.the specifications.
44
Reverse EngineeringReverse Engineering When the only documentation is When the only documentation is
the code itselfthe code itself– Start with the codeStart with the code– Recreate the designRecreate the design– Recreate the specifications Recreate the specifications
(extremely hard)(extremely hard)– CASE tools help (flowcharters, other CASE tools help (flowcharters, other
visual aids)visual aids)
45
Reverse Engineering Reverse Engineering (contd)(contd)
DefinitionsDefinitions– Forward engineeringForward engineering
The usual development process that proceeds from The usual development process that proceeds from analysis through design to implementationanalysis through design to implementation
– ReengineeringReengineering Reverse engineering, followed by forward engineeringReverse engineering, followed by forward engineering Lower to higher to lower levels of abstractionLower to higher to lower levels of abstraction
46
Reverse Engineering Reverse Engineering (contd)(contd)
DefinitionsDefinitions– RestructuringRestructuring
Improving product without changing functionalityImproving product without changing functionality Prettyprinting, structuring code, improving Prettyprinting, structuring code, improving
maintainabilitymaintainability– RefactoringRefactoring
47
Reverse Engineering Reverse Engineering (contd)(contd)
A worse situation is to use a A worse situation is to use a disassembler to create assembler disassembler to create assembler code and then to build a tool to try code and then to build a tool to try to recreate the original high-level to recreate the original high-level language codelanguage code
What if we have only the executable What if we have only the executable code?code?– Treat as black boxTreat as black box
48
Testing during the Testing during the Maintenance PhaseMaintenance Phase
Maintainers view a product as loosely related Maintainers view a product as loosely related modulesmodules– They were not involved in development of the productThey were not involved in development of the product
Regression testing is essentialRegression testing is essential– Store test cases and outcomes, modify as neededStore test cases and outcomes, modify as needed
49
CASE Tools for the CASE Tools for the Maintenance PhaseMaintenance Phase
SCCS ( Source Code Control System)SCCS ( Source Code Control System) RCS ( Revision Control System)RCS ( Revision Control System) CVS ( Concurrent Version System)CVS ( Concurrent Version System) CCC (Change and Configuration Control)CCC (Change and Configuration Control) IBM Rational ClearCaseIBM Rational ClearCase IBM Rational Rose and TogetherIBM Rational Rose and Together DoxygenDoxygen IBM Rational ClearQuestIBM Rational ClearQuest BugzillaBugzilla
50
Metrics for the Metrics for the Maintenance PhaseMaintenance Phase
Metrics for development phasesMetrics for development phases Fault report metricsFault report metrics
51
Challenges of the Challenges of the Maintenance PhaseMaintenance Phase
The development-then-maintenance model is The development-then-maintenance model is unrealistic todayunrealistic today– The client’s requirements frequently change before the The client’s requirements frequently change before the
product is deliveredproduct is delivered– Faults often have to be fixed before the product is deliveredFaults often have to be fixed before the product is delivered– Development from scratch is almost unknown today.Development from scratch is almost unknown today.
Instead, products are built from reused components.Instead, products are built from reused components. Products are modified before deliveryProducts are modified before delivery
52
Future of Software Future of Software EngineeringEngineering
Must people have 20-20 hindsightMust people have 20-20 hindsight– Forecasting the future is much harder!Forecasting the future is much harder!
Possible scenario 1Possible scenario 1– Emphasis on formal techniquesEmphasis on formal techniques– Formal object-oriented techniquesFormal object-oriented techniques
Possible scenario 2Possible scenario 2– Intensive reuse of hundreds of standard classesIntensive reuse of hundreds of standard classes
Possible scenario 3Possible scenario 3– Totally different to anything currently envisionedTotally different to anything currently envisioned