Chapter1420.docx
《Chapter1420.docx》由会员分享,可在线阅读,更多相关《Chapter1420.docx(20页珍藏版)》请在冰豆网上搜索。
Chapter1420
Chapter14
ImplementationPhase
Thesectionon4GLsisimportant,ifonlybecausemanystudentsareunawarethat4GLsexist,letalonetheirimportantroleinthesoftwareindustry;studentsarefrequentlyequallyunawareofcodingstandards(Section14.4).Thematerialontesting(Sections14.6through14.14)isvital.StudentstakingacourseinSoftwareEngineeringgenerallyhavebeenprogrammingforatleast3years,buttheyhavelittleornoknowledgeofsystematictesting.
Problemsolutions
14.1:
Keypoint:
Thisisessentiallyadata-processing(DP)product.
C/C++orJavaisagoodchoiceofimplementationlanguage,andsoisCOBOL.
Ada
Benefits:
trulyportable;stronglytyped;supportsmodularity;excellentfilehandlingcapabilities;supportsabstraction;facilitatesimplementationofobject-orienteddesign.
Costs:
unfamiliartomostDPprogrammers.
BASIC
Benefits:
quickandeasytouse;highlyinteractive;goodstringhandling;goodforDPpurposes.
Costs:
nostandard;notmodular;slowtoexecute;notveryportable.
C/C++
Benefits:
powerfulconstructs;widelyavailable;modular;highlyportable;C++facilitatesimplementationofobject-orienteddesignandhencereuse.
Costs:
easytowritedangerouscode;low-levelfilehandling;hardtomaintainunlesscarefullywritteninastylethatdoesnotuse“fancy”features.
COBOL
Benefits:
businessoriented;largelystandardized;widelyusedandhencemanyprogrammersavailable;widelyavailable;highlyportable.
Costs:
verbose;performstatementchangesglobalvariables,notparameters;notyping.
FORTRAN
Benefits:
efficientcompilation;efficienttoexecute;widelyimplemented.
Costs:
notbusinessoriented;implicittyping;poorfilehandling;incompatiblelanguageextensions.
Java
Benefits:
widelyavailable;stronglytyped;modular;totallyportable;strictlyobject-oriented;facilitatesreuse;goodexceptionhandling.
Costs:
Lisp
Benefits:
interactive.
Costs:
slow;self-modifyingcode;notbusinessoriented;hardlyknownbyDPprogrammers.
Pascal
Benefits:
easytouse;widelyavailable;blockstructured.
Costs:
noseparatecompilation;incompatiblelanguageextensions.
Smalltalk
Benefits:
stronglyobject-oriented;highlyportable.
Costs:
notwidelyused;hardlyknownbyDPprogrammers.
14.2:
Keypoint:
Thisisareal-timeproduct.
Ada,Java,andC/C++aregoodchoicesofimplementationlanguage.
Ada
Benefits:
trulyportable;stronglytyped;supportsmodularity;supportsabstraction;facilitatesimplementationofanobject-orienteddesign;supportsconcurrentprogramming;hasreal-timeconstructs.
Costs:
nocontroloverreal-timescheduling.
BASIC
Benefits:
quickandeasytouse;highlyinteractive.
Costs:
noreal-timefeatures;nostandard;notmodular;slowtoexecute;notveryportable.
C/C++
Benefits:
powerfulconstructs;widelyavailable;modular;highlyportable;caneasilyaccessoperatingsystem;C++facilitatesimplementationofobject-orienteddesign.
Costs:
easytowritedangerouscode;hardtomaintainunlesscarefullywritteninastylethatdoesnotuse“fancy”features;useofoperatingsystemcallstoachievereal-timeconstructsreducesportabilityunlessUNIXisused.
COBOL
Benefits:
largelystandardized;widelyusedandhencemanyprogrammersavailable;widelyavailable;highlyportable.
Costs:
noreal-timefeatures;verbose;performstatementchangesglobalvariables,notparameters;notyping.
FORTRAN
Benefits:
efficientcompilation;efficienttoexecute;widelyimplemented.
Costs:
noreal-timefeatures;implicittyping;incompatiblelanguageextensions.
Java
Benefits:
widelyavailable;stronglytyped;modular;totallyportable;strictlyobject-oriented;facilitatesreuse;goodexceptionhandling.
Costs:
Lisp
Benefits:
interactive.
Costs:
noreal-timefeatures;slow;self-modifyingcode.
Pascal
Benefits:
easytouse;widelyavailable;blockstructured.
Costs:
noreal-timefeatures;noseparatecompilation;incompatiblelanguageextensions.
Smalltalk
Benefits:
stronglyobject-oriented;highlyportable.
Costs:
noreal-timefeatures;notwidelyused.
14.3:
Keypoint:
Thisproducthasbothreal-timeanddata-processingfeatures.
Answeristhereforeacombinationoftheanswersfor14.1and14.2.C/C++orJavaisagoodchoiceoflanguage,alsoAda.
14.4:
Keypoint:
Dataprocessingproductthatmustinterfacewithbothadatabaseandbar-codereaders.
AnappropriatelanguagewouldbeJava,COBOL,orC/C++.
Ada
Benefits:
trulyportable;stronglytyped;supportsmodularity;excellentfilehandlingcapabilities;supportsabstraction;facilitatesimplementationofobject-orienteddesign;caneasilyinterfacewithATMhardware.
Costs:
unfamiliartomostDPprogrammers;almostnoDBMSinterfaces.
BASIC
Benefits:
quickandeasytouse;highlyinteractive;goodstringhandling;goodforDPpurposes;someDBMSinterfaces.
Costs:
nostandard;notmodular;slowtoexecute;notveryportable;BASICcannotinterfacewithbar-codehardware;assemblersubroutinesarenonportable.
C/C++
Benefits:
powerfulconstructs;widelyavailable;modular;highlyportable;caneasilyinterfacewithbar-codehardware;someDBMSinterfaces;C++facilitatesimplementationofobject-orienteddesign.
Costs:
easytowritedangerouscode;low-levelfilehandling;hardtomaintainunlesscarefullywritteninastylethatdoesnotuse“fancy”features.
COBOL
Benefits:
businessoriented;largelystandardized;widelyusedandhencemanyprogrammersavailable;widelyavailable;highlyportable;almosteveryDBMShasaCOBOLinterface.
Costs:
verbose;performstatementchangesglobalvariables,notparameters;notyping;cannotinterfacewithbar-codehardware;assemblersubroutinesarenonportable.
FORTRAN
Benefits:
efficientcompilation;efficienttoexecute;widelyimplemented.
Costs:
notbusinessoriented;poorfilehandling;implicittyping;incompatiblelanguageextensions;fewDBMSinterfaces;cannotinterfacewithbar-codehardware;assemblersubroutinesarenonportable.
Java
Benefits:
widelyavailable;stronglytyped;modular;someDBMSinterfaces;totallyportable;strictlyobject-oriented;facilitatesreuse;goodexceptionhandling;canbeinterfacedwithbar-codehardware.
Costs:
mayhavetobecompiledtomachinecodeoftargetmachine(interpretationisprobablytooslowforthisreal-timeproduct).
Lisp
Benefits:
interactive.
Costs:
slow;self-modifyingcode;notbusinessoriented;hardlyknownbyDPprogrammers;virtuallynoDBMSinterfaces;cannotinterfacedirectlywithbar-codehardware;difficulttointerfacevia(nonportable)assemblersubroutines.
Pascal
Benefits:
easytouse;widelyavailable;blockstructured.
Costs:
noseparatecompilation;incompatiblelanguageextensions;standardPascalcannotinterfacewithbar-codehardware;fewDBMSinterfaces;assemblersubroutinesarenonportable.
Smalltalk
Benefits:
stronglyobject-oriented;highlyportable.
Costs:
notwidelyused;hardlyknownbyDPprogrammers;fewDBMSinterfaces;difficulttointerfacevia(nonportable)assemblersubroutines.
14.5:
Keypoint:
Thisisalsoadataprocessing(DP)product.TheansweristhereforethesameasforProblem14.1.
14.7:
Thereshouldbenodifferenceatallbecauseofthepossibilitythattheorganizationwillexpandorbesoldtosomeoneelse.Also,thereisnoguaranteethatatmaintenancetimetheone-personsoftwaredeveloperwillrecalleverydetailofeverymoduleheorshehaswritten.Finally,lackofanindependentSQAfunctioninaone-personenvironmentmeansthatparticularcarehastobetakentoreducefaults,andadheringtostandardsisonesuchway.
14.8:
Intheorythereshouldbenodifferencewhatsoever;softwareshouldalwaysbebuilttothehighestpossiblestandards.Inpractice,however,acompanythatbuildsintensivecareunitswillusuallytakegreatercaretoensurethattheirsoftwareiscorrectbecausehumanlivesareatstake.(Itissadbuttruethat,formanycompanies,therealreasontheywilltakegreatercareisbecauseoftheriskofbeingsuedshouldtheintensivecareunitsoftwaremalfunction.)Inordertoachievehigherqualitysoftware,codingstandardsarelikelytobemoredetailedandmorerigorouslyenforced.
14.9:
Useboundaryvalueanalysis.AsinthesolutiontoProblem6.15,inputcharacterscanbecategorizedasNEWLINE(newlinecharacter),BLANK(blankcharacter),EOF(endoffilecharacter),orother(anyothercharacters).
1.TestCase:
Emptyfile.
ExpectedOutcome:
NEWLINE
2.TestCase:
FileconsistsofBLANKonly.
ExpectedOutcome:
NEWLINE
3.TestCase:
FileconsistsofNEWLINEonly.
ExpectedOutcome:
NEWLINE
4.TestCase:
WordsseparatedbyasingleBLANKorNEWLINE,andwithallwordsoflengthlessthanMAXPOScharacters.
ExpectedOutcome:
Outputsthetextcorrectly.
5.TestCase:
AtleastonewordoflengthMAXPOScharacters.
ExpectedOutcome:
Thewordisdisplayedonalinebyitself.
6.TestCase:
AtleastonewordoflengthgreaterthanMAXPOScharacters.
ExpectedOutcome:
Error,wordtoolong.
7.TestCase:
MorethanoneBLANKandasingleNEWLINEfollowingtext.
ExpectedOutcome:
AllblanksareignoredandasingleNEWLINEisappendedtotext.
8.TestCase:
MorethanoneBLANKandasingleNEWLINEprecedingtext.
ExpectedOutcome:
BLANKisignored,asingleNEWLINEisprintedandthentextisprocessed.
9.TestCase:
WordsseparatedbymorethanoneBLANKandmorethanoneNEWLINE.
ExpectedOutcome:
EachBLANKisignoredandeachwordmaybeprintedonaseparateline.
10.TestCase:
LastwordfollowedbynoBLANKandnoNEWLINE.
ExpectedOutcome:
TextisprintedwithaNEWLINEappendedtolastword.
14.10:
RefertoFigures6.2and6.3ofthis