A deri ved class now is def ined, that is, a cl ass identical to the base class in many ' but new features m ay be added and existi ng features renamed,reim plemented, suppressed, or cha
Trang 1j '
' ;
f
. f unet ion open-di sk-fi l e funeti on open-tape-f i e f unct i on open-di sket t e-f i e
I
I
l
I
I
Di skFi l ecl ass TapeFil ecl ass Di sketteFi l ecl aes
Im plem entation of Imptementation of lmplementation of
tbr a disk file fofa tape file for a diskette file :
( b)
Flgure I#.a Def i ni ii on of base cl ass Fi l ecl oss wi t h deri ved cl ass Dî skFi l ecl css, T opeFi l ecbss, . and Di ske- Fi l ecl oss.
. A deri ved class now is def ined, that is, a cl ass identical to the base class in many
' but new features m ay be added and existi ng features renamed,reim plemented,
suppressed, or changed in other ways Furthermore, these changes m ay be made
j w i thout havi ng an effect on the base class or any other deri ved cl asses However,
) suppose now t hat the base class itself is changed lf t his happens, all deri ved cl asses
1 are changed in t he same way In other words, t he strength of i nherit ance i s that new
, l eaves can be added t o the inheritance tree (or graph, if the impl ementation l anguage
l supoorts m ulti ole inheri tance, as C++ does) w it hout alt erinz anv other cl ass in the
j tree But if an interi or node of the tree is changed in any way, then this change is
. propagated to al1 i descendants (the ii fragil e class probl em'' ) Thus, inheritance is
! another feat ure of object-ori ent ed technol ogy that can have a major positi ve i n:uence
1
on devel opment but a negative i mpact on maint enance.
!
J
p :v:kopM :NT SKILLS
Earli er in this chapter m uch w as sai d about t he skill s needed for m aintenance Fof
,the abi li ty to determ inethe cause of afail ure of alarge product '
i was deem edessenti al But t hi s skil l is notneeded exclusively forproduct m aintenance
!
1
l
.)
I
Trang 2-k ',
I h
'
'
' I l y RE VERSE ENGI NEERI NG sos I j lt i
I .
: l i s used throughout integration and product t esting. Anot her vi tal skil l i s the abi lity 1
I
. t o funct i m ef f ect i vel y wi t hout adequat e document at i on Agai n, t he document at i on j
' r ar el y icompl et e whi l e i nt egr at i on and product es t ng ar e under way Al so st r es sed j ' 1
j kills w ith regard to specihcation, design, implem entation and integration, 1 ' was that s
and t es ti ng are essenti al for adapti ve and perf ect i ve mai nt enanee These act i vi t es al so i ( 1
' are carr e ou i d t during the devel opm ent process, and each requires specialized ski lls ' l
.
' ln other words, the skil ls a maintenance program m er needs are di ftkrent i n no way I i
j
from those needed by software professionals specializing in other phases of softw are l '
1 producti on.The key point is that a m aintenance program m er m ust not be m erely
skill ed i n a broad variety of areas but highl y skill ed i n 6 111 those areas Although t he j
'
as desi gn or testing, the software m ai ntainer m ust be a special ist in virtually every 1
1
!
1
l
;
! i 1ê T R EV KRSE EN / IN EERIN / ; 7 i l
.1 1
p
E
As has been pointed out,som etim es the only documentati on available tor m ai nte- l
11
nan ce s t he our c code t e f ( Thi s happe ns aI l oo r eque nt l when ma i nt a ni ng 2 ! ! h
Iegacy' A'.v, s /c/ z? ç, that is, software in current use but devel oped some l 5 or 20 years ago, i
if not earlien) Under t hese circumstances, m aint aining t he code can be ext rem el y
dif-b hcult O ne w ay of handling this problem is t o start with the source code and att em pt '
! I
t to recreate the design documents or even the speeihcations.Thi s proeess is call ed , !
r CASE t ool s can assi s wi t h t hi s proeess One of he si mpl est i s a pr et t y pri nt er ' j
!
(Secti on 5 6), which may help displ ay the code more clearly Other t ools construct l k l 1
-di
agr ams, such as owchar t or UML di agrams, di rect l y t r om t he sour ee code' hes e , j i
1
: Once t he m aintenance team has reconstruct ed the design, t here are two possibil- : 1
; i ti es. One alt ernative i s to at tempt to reconstruct t he specif ications, m odify the recon- ! ' )
-j ; struct ed specif icatit m s to renect the necessary changes,and reimplement the product l '
l
the usual way (W i thin the context of reverse engineering, the usual developm ent j j
process that proceeds from specif icati ons through design to code is call ed jbrward j i
engi neering The process of reverse engineering foll owed by forw ard engineeri ng j
som etimes is called reengi neering.) In practice, reconstruction of the specil ications 1 1,
' l t he reconstructed design is modihed and 1
is an ext remely hard task.M ore trequent y, t l 1 , the modil ied design then is forward engineered.
A related activi ty often pert brmed during the m aint enance phase is restructuring I '
Reverse engineeri ng takes the product from a lower level of abstracti on to a hi gher ! 1
level ot abstraction, tor exam pl e, from code to desi gn Forward engi neeri ng takes the I
hl m a hi gher v el of abs t ct i on o a l ower ev el Res t u ct ur i g howev er , ' )
!
(
l
Trang 35@* t H A p T E R 44 * M oinfenante Phase
takes plaee at the same level lt is the process of improving the product wi thout changing its functionality Pretty printing is one form of restructuring' , so is convert i ng
) code f r om unst r uct ur ed t o st r uct ured f orm I n gener al , rest r uct uri ng i per formed t
t make t he sour ce code ( or desi gn or even t he dat abase) easi er o mai nt ai n '
A worse sit uati on occurs i f the source code is lost and the execut able versi on of the product i s all that i s available At f irst si ght it m ight seem t hat the only possi bl e !
l way to recreat e the source code is to use a disassembler t o creat e assembl er code
i
j then buil d a tool (that mi ght be termed a reverse compi ler) to try t o recreat e the
' Or g i inal high-l evel l anguage code A number of virtuall y i nsurmountable problems
accom pany t his approach'
l The nam es of the vari abl es w il l have been l ost as a consequence of t he origi nal com p
2 M any compi lers optimize the code in some w ay, m aking i t extrem ely difhcul t att em pt to recreat e the source code.
3 A construct such as a l oop in the assembler coul d correspond to a num ber of different possible constructs i n the source code.
: ln practi ce, therefore, t he exist ing product is t reated as a black box and reverse
engi neering is used t o deduce the specifications from the behavi or of the current product The reconstructed speci hcati ons are modified as required, and a new versi on
of the product is forward engineered from those specihcati ons.
'!
l
1 W hil e the product is being devel oped, m any m em bers of t he development t eam have
!
! a broad overview of the product as a whole, but as a result of t he rapid personnel
l turnover in the computer industrys it is unlikely that members of the maintenance t eam
;
j during t he m aintenance phase will have been i nvolved in the original devel opment.
j Theref ore, he mai nt ai ner ends o see t he pr oduct as a set of l oosel y r el at ed modul es
1 and generall y is not aw are t hat a change to one modul e may seriously affect one or
1 mor e ot her modul es and hence t he pr oduct as a whol e Even i f t he mai nt ai ner wi shed
l
to understand every aspect of the product, the pressures to tix or to extend the product generall y are such that no time is al lowed for the detailed study needed to achieve this Furtherm ore in many cases, lit tle or no docum entation i s avai labl e to assi st i n ' gaining that understanding One w ay of trying to m inimize this di ffi cul ty is to use ,
rexression testi nc, that is testing the changed product against previous test cases t o ' ensure that it still works correctly.
, For this reason, i t is vi tal to store all test cases, together wi th their expect ed
outcom es in m achine-readable t brm A s a result of changes made t o t he product, certain stored test cases m ay have to be m odil ied For exam pl e, if sal ary w i thholdi ng percentages change as a consequence of tax legislati on, then the correct output from
j
l a payroll product for each test case involving wi thholding will change.Sim il arly, i f
1 sate ll ite observati ons lead to correcti tl ns in the latitude and longit ude of an island,t hen
! the correct output from a product that calcul ates the positi on ot an aircratt using the
1
Trang 4i l i ' @ k
p
l ?
- 1
1.1* METRI CS FoR THE MAI NTENANCE PHM E 5@7 ' l ?
l !
j coordinates of that island will changecorrespondingl y Depending on the mai ntenance l I performed, some val id test cases will become invalid But the computations that need l '
t o be made t o correct t he stored test cases essentially are the same as woul d have to l
be made to set up new test data for checki ng that the maintenance has been correctly l i
perform ed
.No additi onal work therefore i s i nvolved in maintaining the f il e of test i 1 1
lt can be argued that regression testing is a wast e of tim e because regression l y
t es t g r equi r s he compl et e pr odu ct be et e t d a gai ns t hos t of es t cas es , mos t ) 1 1
of whi ch apparentl y have not hing t o do wi th the modul es modihed in the course of l 1 1
1 : product m aintenance.The word apparently i s cri tical in the previous sent ence The j. ! d
angers of unwi tting side effects of mai ntenance (t hat i s the introducti on of regression J i I
i, 2
-faults) are t oo great for that argument to hold wat er' , regressi on t esti ng is an essenti al l
1 : ! 1
'
( i
j
'
1 : j
1 1
: !
! l
l i unr easonabl e t o expect mai nt enance pr ogrammers to keep t ack manual l y of he r j
: various revision numbers and assi gn the next revision num ber each ti m e a modul e is r )
1
updated Unl ess the operating system incorporates versi on control, a version control j
: tool such as t he UNIX tools sccs (source code control system) (Rochkind, 19751, rcs i 1
'
(revision control syst em) (Ti chy, l 9851, or cvs (concurrent versi ons system) (Louki des j
t
.
revisi ons are updated appropriately A conf iguration control tool is needed A typical
l 1 exampl e of a commerci al ool CCC ( ehange and conf i gur at i on cont r ol ) Even i t he j j
at the very least a bt lil d tool must be used i n conjunction with a version cont rol t ool ! i
j ) A
not her cat egor y of CASE t ool s vi rt ual l y ess ent i al dur i ng t he mai nt enance phase i j j l
a f ul Sec t r t cki on ng 6.7 described some categori ool ha t ke e ps cor d of es of por CASE tools that can assist t ed a ul t not ye t i e d in reverse ( ! l ( l I engineering and reengi neeri ng Exam pl es of such tools that assist by creating visual 1
) di
spl ays of he st r uct ur e of t he pr oduct i ncl ude Bat t emap, Teamwork, and Bachman : j l R
eengineering Product Set.
M aintenance i s dif hcul t and t - rustrati ng The very l east that m anagem ent can do
i s to provide the m ai ntenance team with the t ool s needed for efficient and effeetive r
pr O
' k
1
j .1
1*
I l
î ) The acti viti es of the maintenance phase essent ial ly are specif ication
plement ation, int egration, t est ing, and docum ent at ion Therefore, t he met ri cs that j j
l .
1
Trang 5soe t u A p T : R 11 * M oi ndenante Phose '
measure these acti viti es are equally appli cable to the m aint enance phase For
exam-pl e, he com pl exity metri cs of Sect ion 14 8 2 are relevant to maintenance, i n that a modul e w i th high com pl exi ty i s a likely candidate for inducing a regression faul t Particular care m ust be taken in m odifying such a modul e '
In additi on, m etri cs speci fic t o the mai ntenance phase incl ude m easures relati ng
to software fault reports, such as the tot al number of faul ts reported and cl assi hcati ons
of those faul ts by severit y and type ln addition i nform ati on regarding the current status of the faul t reports i s needed For exam pl e there is a considerable difference between having 13 cri tical faults reported and f ixed during 2002 and having onl y 2 criti cal faults reported during that year with nei ther of them f ixed.
A INTENA NtK P HASE
1
' A num ber of faults have been seeded in the source code of the case study.
1
'
Det ecting and correcting t hree of them is l eft as an exercise (Problems 16.1 1 '
$
i
A major chal lenge of the maintenance phase is expl ained in detail i n the Just in
Case You W anted to Know box on page 1 0 In bri efp cl assi cal softw are
engineer-i ng can be descri bed as deb t elolll nellt -tl l el l-mal ' ntel lance That is l irst the product is developed from scratch and deli vered t o t he cli ent From then on it is maintained This development-then-mai ntenance m odel is consistent wi th the det ini tions of IEEE Standard 610 2: A11 software producti on activi ties carri ed out before the software
is del ivered to the cl ient are consi dered to be devel opm ent and a1 l activi ties after
delivery consti tute maintenance IIEEE 610 2 19901.
The developm ent-then-m aint enance model is unrealisti c today:
l The cli ent' s requi rem ents frequentl y change before the product is deli vered.
'
; 2 Faul ts often have to be hxed before t he product is del ivered.
3 Developm ent from scratch i s becom ing i ncreasingl y rare Instead, much of t he ( product is buil t out of reused com ponents, and these reused com ponents fre-' quentl y need to be m odil ied before they can be utili zed i n t he new product.
For t hese three reasons a product al most al ways has to be modi fied before
de-Ii very, and the acti viti es performed when carrying out those modihcations are
indis-1 tingui shabl e from those of classi cal maintenance.
1 The r eal i ti es of mai nt enance ar e capt ur ed i n I SO/I EC St andar d 12207 whi ch
i st ates that the m aintenance process is activat ed when ç' software undergoes modi
Trang 6-j '
I '
j ' FoR FURTHER READING 5@@ 1 :
I h
cations to code and associ ated documentation due to a problem or the need for j
improvement or adaptat on g ,
ook forward to the day when a greater proporti on ot t he sottware engineering j '
i t accepts t hat S: maint enance' ' is an acti vity performed throughout the soft- l 1 commun y
l 1 ware life cycl e.This will I ead to major i mprovement s, not just to the maintenance 1 , j
1 1
l 1 1
l I
;
I I
l i
' I
E
i .I @
ai nt enance i s an i mpor t ant and chal l engi ng s of t war e act i vi t y ( Sect i ons 16.1 and t j
16 2) This is ill ustrat ed by means of the case study of Section l 6 3 Issues relating t o 1 i
' i tenance are described (Section 16 4), i ncl udi ng the probl em ' 1 1
of repeat ed maint enance (Secti on 16 4 4) The mai ntenance of object-oriented soft- y !
ware is discussed in Secti on l.5. The skil ls t hat a m ai ntenance programm er needs j
:
are t he same as those of a devel oper' , the difference i s that a developer can specialize )
in One asl lect Of the software process, whereas t he maintainer must be an expert in all ( I j
aspects of software producti on (Section 16 6) A descripti on of reverse engineering ' 1
1
is gi ven in Section l
.7 Next foll ows a descripti on of testing during the mai ntenance j g
phase (Secti on 16 8) and CASE tools for mai ntenance (Secti on 16 9) M etri cs for the ! 1 1
m aintenance phase are di scussed in Section 1 6 0 M aint enance of the Air G ourm et case study, ci ted in Section l 6 1 is I eft as an exercise The chapter concl udes with
a discussion of the chall enges of the maintenance phase (Section l6 12).
1
Acl assi c s ource of i nf or mati on on mai nt enance i ( Li ent z and Swanson, 1 9801 Usef ul 2 1
material on maintenance can be found in (Longst reet, 19901 gBasili, 19901 presents I j j j
;
an int eresti ng vi ew of m aintenance as a reuse process.Regression testing is anal yzed j ! )
I ' :
i n (Rot hermel and Harrold, 19961 , predicting its cost effectiveness is descri bed i n i (Rosenblum and W eyuker 19971 Regression t esting in an i ndustrial environment is
iscussed in (Onoma, Tsai, Poonawala, and Suganuma, 19981 Planning of reengi- 2 d
neeri ng i s cover ed i n ( Sneed, l 9951, one of t he many ar t cl es on reengi neer i ng i n j
the January 1995 issue of IEEE Soft ware Costs and benefits of reengineering are i
di scuss ed i n ( Adol ph, 19961 ( Charet t e Adams , and Whi t e, 19971 des cri be r sk man- j
agement wi thin t he framework of maint enance And (von M ayrhauser and Vana, i 1
' 1.
19971 describe vari ous mechanisms of program comprehensi on for maintenance I
of large-scal e products A profi le of successful reengi neeri ng projects is given in ' (Teng Jeong, and Grover, 19981 M aint enance of information systems is descri bed in
(Bisbal, Lawless, W u, and Grimson, 19991 The use ot met ri cs wi thin the cont ext ot 1 ! maintainabili ty is di scussed in (Banker, Datar, Kemerer and Zwieg, l 993, and Henry, 1
q H
j '
I
Trang 751@ t u A p T : R 14 @ M oi nfenonie Phase
The impact on mai ntenance of t he use of obj ects is described i n gl- lenry and 16.1 Humphrey, 1 990, and M ancl and Havanas 1 9901 M aint enance of speciéc
object-ori ent ed products is descri bed i n (Lejter M eyers, and Rei ss, l 992, and W il de, j;.j Mat thews, and Hui tt, l 9931.
Papers on software m aintenance appear in t he M ay l 994 issue of Comm unications
q/' t he ACM The Jul y/August 1 998 issue of IEEE Stftware contains a number of ( arti cles on l egacy systems, especi all y gRugaber and W hite, l 9981 The proceedi ngs jw
.j
the annual Conference on Software M aint enance are a broadly based source of
int - ormati on on aIl aspects of m aintenance.
1f.1
!;.j
1d.1
P RO BU M S
i 16.1 W hy do you think that t he m ist ake i s frequently nlade of considering software m ai
n-tenance to be inferior to software development?
16.2 Consi der a product that determ ines whether a com puter is vi rus free.Describe why ( such a product i s I ikel y to have m ul tipl e variations of many of i ts modul es.W hat ar e
I the i m pli cations for maintenance? How can the resul ting probl em s be solved?
'
. 16.3 Repeat Problem l 6 2 for the automat ed l ibrary circul ati on syst em of Problem 8 7 '
:
j 16 4 Repeat Problem l 6 2 for t he product of Problem 8.8 that checks whether a bank ' .
stat em ent i s correct.
: 16.5 Repeat Problem 16.2 for t he automat ed tell er machine of Probl em 8 9.
i 1ô 6 You are the manager in charge of m ai ntenance in a Iarge software organizati on
.What
i qualiti es do you Iook for when hi ring new employees?
'
j
l 1 6.7 w hat are the implicati ons of m ai ntenance for a one-person software producti on
1 8 You have bee n asked t o build a computeri zed fault report fil e. W hat sort of data woul d
I you st ore in t he fil e? W hat sort of queries could be answered by your tool' ? W hat sort
1 of queri es coul d not be an swered by yt lur tool ?
1f.9 You recei ve a memo from the vi ce-presi dent for soft ware m aintenance of Ye Olde ;
Fashioned Software Corporation (Pr( )bIem 15 6) pointing out t hat, for the foreseeabl e
futures Olde Fashioned w i ll have to maintain t ens of m ill ions ofli nes of CO BO L code and aski ng your advice with regard to CASE tool s for such maint enance W hat do
16.10 (Term Project) The free accommodati on and transportati on provided by the Joini ng '
Children w i th their Fam il ies subcomm itt ee of Broadl ands Area Chil dren's Hospi tal
(Appendix A) currentl y is restri cted to chi ldren whose parents li ve withi n a 500-mi1 e I
j radius of Broadlands Now this restriction is t o be lifted W hat changes need t o be
i made to your product of Problem 15.10? Com pare your answer to the answer you
i
I gave to Probl em I l
Trang 8jj j j j
.
j j
I l '
1ô.1 1 (Case Study) Correct the implementati on of Secti on l 5 3 so that once a seat has been ' 1
l assigned t o a passenger it cannot subsequently be assigned to another passenger 1
'
'
ever, there are pl aces in the impl ementation of Section l 5 3 where the program m er !
ë seem s to have t hought that there were only 12 kinds Fix the im plem entation appro- i
j .
I : j l
'
.13 (Case Study) The implementation of Section 15.13 does not check t hat, when t he user j l
! inputs m eal qual ity, the value is in the range 1 through 5 Fix this faul t l (
!
2
16.14 (Case Study) lmprove t he aestheti c appearance of a11 the reports i n the i mplementati on l 1
1 ' of section 15.13 by adjusti ng the ali gnment of the various components j ! ,
! 1 6 1 5 ( Case St udy) Repl ace t he menu- dr i ven i nput rout i nes n t he i mpl ement at i on of Sect i on ' ' !
I : 15
1& 1f (Readings in Software Engi neeri ng) Your i nstruct orwil l distri bute copi es of (Rugaber :: and Whi te, 19981 W hat do you see as the bi ggest challenges of mai ntai ning l egacy j j
'
l
'
j '
'
7
I CaS I COW it he Tar Pi t Reengi neer i ng a Legacy Sys t em, ' ' 1
! IEEE Softb vare 13 (May l 996) pp 4 1-47 : ! l I '
(Banker, Dat aq Kemerer, and Zwi eg, 1 9931 R D BANKER, S M DATAR, C F KEMERER, ' I AND D ZwIEG, t t soft ware Compl exi t y and Maintenance Costs, ' Communicati ons ofthe 5
ACM 36 (November 1993), pp 8 1-94 : 1
( Basi li
, 19901 V R BASILI , t ' Viewing Mai nt enance as Reuse-ori ent ed Software j j
(Bi sbal, Lawl ess, W u, and Gri msons 1 9991 J BISBAL, D LAw l - Ess, B W I J, J GRI MSON, '
tt l wegacy lnformati on Syst ems: lssues and Di recti onss ' IEEE Soft ware 16 l 1
g
(Sept ember/october l 999), pp I 03-1 1 l '
1 i tcharett e
,Adam s, and W hi t e, 19971 R N CHARETTE, K M ADAMS ANn M B W HITE j ) i
' Managing Risk in Sof tware Mai nt enance, ' IEEE s' ofrwwr c 14 (May/lune 1 997), 1 l l 1 i
gl - lenry and Humphr ey, 19901 S M HENRV AND M HUMPHREY, ' ' A Cont roll ed Experiment
:' t o Eval uat e Maintai nabil it y of Object-ori ented Software, '' Proceedings oft he IEEE k
! i
. Confer ence on sk// wt zrc Maintenance, San Di ego, CA, November 1 990, pp 258-65 j g
gl denry, Henry, Kafur a, and M atheson 19941 J HENRY, S HENRY, D KAFI JRA, AND '
L M A' rHssoN, ' ' lmprovi ng Soft ware M ai nt enance at M arti n M ariett a, ' IEEE Softbvare I
11 (JuI y 19
1
(IEEE 6 l0 2, 9901 ' ' A Gl ossary of Sof tware Engineering Termi nol ogys ' IEEE 610 12- 1 990, i 2
lnst it ut e of El ectri cal and El ectroni c Engineers, New York, 1990 ' û
: SO/ I EC 1 2207: 995, nfor mat i on Technol ogy sof t war e ' i J
I SO/ I EC l 2207, 1 9951
' l nt er nat i onal Or gani zat i on f or St andar di zat i on, I nt ernat i onal j
El ect r ot echni cal Commi s si on, Geneva, 1995 j l l )
(Li entz and Swanson, 19801 B P LI ENTZ ANt ) E B SwAxsop k, Software Maintenance I
anagement: zt Study o ft he Mai ntenance c/ -t l pp/ pr dr cr Appli cati ons Softv vare i n 487 i
Dat a Processing O r ganizati ons Addison-W esley, Readi ng, M A, l 980 (
'
j '
!
Trang 9j '
1 l
!
1
i
A R R œ M o : x ( k
'?
1
J
A IR * @ U RM ET QA SE STU PT :
:
t pIp P R@ T@ TT PE
1 The C rapi d prot otype for the Ai r Gourmet case study is avail able on the World Wi de Web at
-.mhheacom/engcs/compsci /schach.
! ' ( -1
1 ,
i
;
E
!
:
:
)
1
; :
i
l
' :
Trang 10r j
i
t p
l
)
I
-j )
' j
; ;
! j
A IR * @ URM KT QA S: sTu py r ; l
p !
!
.
j j j
Yhe Java rapi d prototype for t he Ai r Gourmet case study is avail abl e on the World W i de Web at j 1 1
j I
l
j '
l
i !
? j
! ;
!
'
j
!
1 r (
l
j
! I
2 l
'
l
1
!
!
-!
521
f
j '