slide 1.1 object-oriented and classical software...
TRANSCRIPT
Slide 1.1
© The McGraw-Hill Companies, 2007
Object-Oriented andClassical Software
Engineering
Seventh Edition, WCB/McGraw-Hill, 2007
Stephen R. [email protected]
Slide 1.2
© The McGraw-Hill Companies, 2007
CHAPTER 1
THE SCOPE OF SOFTWARE
ENGINEERING
Slide 1.3
© The McGraw-Hill Companies, 2007
Outline
Historical aspects Economic aspects Maintenance aspects Requirements, analysis, and design aspects Team development aspects Why there is no planning phase
Slide 1.4
© The McGraw-Hill Companies, 2007
Outline (contd)
Why there is no testing phase Why there is no documentation phase The object-oriented paradigm The object-oriented paradigm in perspective Terminology Ethical issues
Slide 1.5
© The McGraw-Hill Companies, 2007
1.1 Historical Aspects
1968 NATO Conference, Garmisch, Germany
Aim: To solve the software crisis
Software is deliveredLateOver budgetWith residual faults
Slide 1.6
© The McGraw-Hill Companies, 2007
Standish Group Data
Data on9236projectscompletedin 2004
Figure 1.1
Slide 1.7
© The McGraw-Hill Companies, 2007
Cutter Consortium Data
2002 survey of information technologyorganizations78% have been involved in disputes ending in litigation
For the organizations that entered into litigation:In 67% of the disputes, the functionality of the
information system as delivered did not meet up to theclaims of the developers
In 56% of the disputes, the promised delivery dateslipped several times
In 45% of the disputes, the defects were so severe thatthe information system was unusable
Slide 1.8
© The McGraw-Hill Companies, 2007
Conclusion
The software crisis has not been solved
Perhaps it should be called the softwaredepressionLong durationPoor prognosis
Slide 1.9
© The McGraw-Hill Companies, 2007
1.2 Economic Aspects
Coding method CMnew is 10% faster than currentlyused method CMold. Should it be used?
Common sense answerOf course!
Software Engineering answerConsider the cost of trainingConsider the impact of introducing a new technologyConsider the effect of CMnew on maintenance
Slide 1.10
© The McGraw-Hill Companies, 2007
1.3 Maintenance Aspects
Life-cycle modelThe steps (phases) to follow when building softwareA theoretical description of what should be done
Life cycleThe actual steps performed on a specific product
Slide 1.11
© The McGraw-Hill Companies, 2007
Waterfall Life-Cycle Model
Classical model (1970)
Figure 1.2
Slide 1.12
© The McGraw-Hill Companies, 2007
Typical Classical Phases
Requirements phaseExplore the conceptElicit the client’s requirements
Analysis (specification) phaseAnalyze the client’s requirementsDraw up the specification documentDraw up the software project management plan“What the product is supposed to do”
Slide 1.13
© The McGraw-Hill Companies, 2007
Typical Classical Phases (contd)
Design phaseArchitectural design, followed byDetailed design“How the product does it”
Implementation phaseCodingUnit testingIntegrationAcceptance testing
Slide 1.14
© The McGraw-Hill Companies, 2007
Typical Classical Phases (contd)
Postdelivery maintenanceCorrective maintenancePerfective maintenanceAdaptive maintenance
Retirement
Slide 1.15
© The McGraw-Hill Companies, 2007
1.3.1 Classical and Modern Views of Maintenance
Classical maintenanceDevelopment-then-maintenance model
This is a temporal definitionClassification as development or maintenance depends
on when an activity is performed
Slide 1.16
© The McGraw-Hill Companies, 2007
Classical Maintenance Defn — Consequence 1
A fault is detected and corrected one day after thesoftware product was installedClassical maintenance
The identical fault is detected and corrected oneday before installationClassical development
Slide 1.17
© The McGraw-Hill Companies, 2007
Classical Maintenance Defn — Consequence 2
A software product has been installed
The client wants its functionality to be increasedClassical (perfective) maintenance
The client wants the identical change to be madejust before installation (“moving target problem”)Classical development
Slide 1.18
© The McGraw-Hill Companies, 2007
Classical Maintenance Definition
The reason for these and similar unexpectedconsequencesClassically, maintenance is defined in terms of the time
at which the activity is performed
Another problem:Development (building software from scratch) is rare
todayReuse is widespread
Slide 1.19
© The McGraw-Hill Companies, 2007
Modern Maintenance Definition
In 1995, the International Standards Organizationand International Electrotechnical Commissiondefined maintenance operationally
Maintenance is nowadays defined asThe process that occurs when a software artifact is
modified because of a problem or because of a need forimprovement or adaptation
Slide 1.20
© The McGraw-Hill Companies, 2007
Modern Maintenance Definition (contd)
In terms of the ISO/IEC definitionMaintenance occurs whenever software is modifiedRegardless of whether this takes place before or after
installation of the software product
The ISO/IEC definition has also been adopted byIEEE and EIA
Slide 1.21
© The McGraw-Hill Companies, 2007
Maintenance Terminology in This Book
Postdelivery maintenanceChanges after delivery and installation [IEEE 1990]
Modern maintenance (or just maintenance)Corrective, perfective, or adaptive maintenance
performed at any time [ISO/IEC 1995, IEEE/EIA 1998]
Slide 1.22
© The McGraw-Hill Companies, 2007
1.3.2 The Importance of Postdelivery Maintenance
Bad software is discarded
Good software is maintained, for 10, 20 years ormore
Software is a model of reality, which is constantlychanging
Slide 1.23
© The McGraw-Hill Companies, 2007
Time (= Cost) of Postdelivery Maintenance
(a) Between 1976 and 1981(b) Between 1992 and 1998
Figure 1.3
Slide 1.24
© The McGraw-Hill Companies, 2007
The Costs of the Classical Phases
Surprisingly, the costs of the classical phaseshave hardly changed
Figure 1.4
Slide 1.25
© The McGraw-Hill Companies, 2007
Consequence of Relative Costs of Phases
Return to CTold and CTnew
Reducing the coding cost by 10% yields at most a0.85% reduction in total costsConsider the expenses and disruption incurred
Reducing postdelivery maintenance cost by 10%yields a 7.5% reduction in overall costs
Slide 1.26
© The McGraw-Hill Companies, 2007
1.4 Requirements, Analysis, and Design Aspects
The earlier we detect and correct a fault, the less itcosts us
Slide 1.27
© The McGraw-Hill Companies, 2007
Requirements, Analysis, and Design Aspects (contd)
Figure 1.5
The cost ofdetecting andcorrecting afault at eachphase
Slide 1.28
© The McGraw-Hill Companies, 2007
Requirements, Analysis, and Design Aspects (contd)
Thepreviousfigureredrawnon alinearscale
Figure 1.6
Slide 1.29
© The McGraw-Hill Companies, 2007
Requirements, Analysis, and Design Aspects (contd)
To correct a fault early in the life cycleUsually just a document needs to be changed
To correct a fault late in the life cycleChange the code and the documentationTest the change itselfPerform regression testingReinstall the product on the client’s computer(s)
Slide 1.30
© The McGraw-Hill Companies, 2007
Requirements, Analysis, and Design Aspects (contd)
Between 60 and 70% of all faults in large-scaleproducts are requirements, analysis, and designfaults
Example: Jet Propulsion Laboratory inspections1.9 faults per page of specifications0.9 per page of design0.3 per page of code
Slide 1.31
© The McGraw-Hill Companies, 2007
Conclusion
It is vital to improve our requirements, analysis,and design techniquesTo find faults as early as possibleTo reduce the overall number of faults (and, hence, the
overall cost)
Slide 1.32
© The McGraw-Hill Companies, 2007
1.5 Team Programming Aspects
Hardware is cheapWe can build products that are too large to be written by
one person in the available time
Software is built by teamsInterfacing problems between modulesCommunication problems among team members
Slide 1.33
© The McGraw-Hill Companies, 2007
1.6 Why There Is No Planning Phase
We cannot plan at the beginning of the project—we do not yet know exactly what is to be built
Slide 1.34
© The McGraw-Hill Companies, 2007
Planning Activities of the Classical Paradigm
Preliminary planning of the requirements andanalysis phases at the start of the project
The software project management plan is drawnup when the specifications have been signed offby the client
Management needs to monitor the SPMPthroughout the rest of the project
Slide 1.35
© The McGraw-Hill Companies, 2007
Conclusion
Planning activities are carried out throughout thelife cycle
There is no separate planning phase
Slide 1.36
© The McGraw-Hill Companies, 2007
1.7 Why There Is No Testing Phase
It is far too late to test after development andbefore delivery
Slide 1.37
© The McGraw-Hill Companies, 2007
Testing Activities of the Classical Paradigm
VerificationTesting at the end of each phase (too late)
ValidationTesting at the end of the project (far too late)
Slide 1.38
© The McGraw-Hill Companies, 2007
Conclusion
Continual testing activities must be carried outthroughout the life cycle
This testing is the responsibility ofEvery software professional, andThe software quality assurance group
There is no separate testing phase
Slide 1.39
© The McGraw-Hill Companies, 2007
1.8 Why There Is No Documentation Phase
It is far too late to document after developmentand before delivery
Slide 1.40
© The McGraw-Hill Companies, 2007
Documentation Must Always be Current
Key individuals may leave before thedocumentation is complete
We cannot perform a phase without having thedocumentation of the previous phase
We cannot test without documentation
We cannot maintain without documentation
Slide 1.41
© The McGraw-Hill Companies, 2007
Conclusion
Documentation activities must be performed inparallel with all other development andmaintenance activities
There is no separate documentation phase
Slide 1.42
© The McGraw-Hill Companies, 2007
1.9 The Object-Oriented Paradigm
The structured paradigm was successful initiallyIt started to fail with larger products (> 50,000 LOC)
Postdelivery maintenance problems (today, 70 to80% of total effort)
Reason: Structured methods areAction oriented (e.g., finite state machines, data flow
diagrams); orData oriented (e.g., entity-relationship diagrams,
Jackson’s method);But not both
Slide 1.43
© The McGraw-Hill Companies, 2007
The Object-Oriented Paradigm (contd)
Both data and actions are of equal importance
Object:A software component that incorporates both data and
the actions that are performed on that data
Example:Bank account
Data: account balance Actions: deposit, withdraw, determine balance
Slide 1.44
© The McGraw-Hill Companies, 2007
Structured versus Object-Oriented Paradigm
Information hiding Responsibility-driven design Impact on maintenance,
development
Figure 1.7
Slide 1.45
© The McGraw-Hill Companies, 2007
Information Hiding
In the object-oriented versionThe solid line around accountBalance denotes that
outside the object there is no knowledge of howaccountBalance is implemented
In the classical versionAll the modules have details of the implementation of
account_balance
Slide 1.46
© The McGraw-Hill Companies, 2007
Strengths of the Object-Oriented Paradigm
With information hiding, postdelivery maintenanceis saferThe chances of a regression fault are reduced
Development is easierObjects generally have physical counterpartsThis simplifies modeling (a key aspect of the object-
oriented paradigm)
Slide 1.47
© The McGraw-Hill Companies, 2007
Strengths of the Object-Oriented Paradigm (contd)
Well-designed objects are independent unitsEverything that relates to the real-world item being
modeled is in the corresponding object —encapsulation
Communication is by sending messagesThis independence is enhanced by responsibility-driven
design (see later)
Slide 1.48
© The McGraw-Hill Companies, 2007
Strengths of the Object-Oriented Paradigm (contd)
A classical product conceptually consists of asingle unit (although it is implemented as a set ofmodules)The object-oriented paradigm reduces complexity
because the product generally consists of independentunits
The object-oriented paradigm promotes reuseObjects are independent entities
Slide 1.49
© The McGraw-Hill Companies, 2007
Responsibility-Driven Design
Also called design by contract
Send flowers to your mother in ChicagoCall 1-800-flowersWhere is 1-800-flowers?Which Chicago florist does the delivery?Information hidingSend a message to a method [action] of an object
without knowing the internal structure of the object
Slide 1.50
© The McGraw-Hill Companies, 2007
Classical Phases vs Object-Oriented Workflows
There is no correspondence between phases andworkflows
Figure 1.8
Slide 1.51
© The McGraw-Hill Companies, 2007
Analysis/Design “Hump”
Structured paradigm:There is a jolt between analysis (what) and design
(how)
Object-oriented paradigm:Objects enter from the very beginning
Slide 1.52
© The McGraw-Hill Companies, 2007
Analysis/Design “Hump” (contd)
In the classical paradigmClassical analysis
Determine what has to be done
Design Determine how to do it Architectural design — determine the modules Detailed design — design each module
Slide 1.53
© The McGraw-Hill Companies, 2007
Removing the “Hump”
In the object-oriented paradigmObject-oriented analysis
Determine what has to be done Determine the objects
Object-oriented design Determine how to do it Design the objects
The difference between the two paradigms isshown on the next slide
Slide 1.54
© The McGraw-Hill Companies, 2007
In More Detail
Objects enter hereFigure 1.9
Slide 1.55
© The McGraw-Hill Companies, 2007
Object-Oriented Paradigm
Modules (objects) are introduced as early as theobject-oriented analysis workflowThis ensures a smooth transition from the analysis
workflow to the design workflow
The objects are then coded during theimplementation workflowAgain, the transition is smooth
Slide 1.56
© The McGraw-Hill Companies, 2007
1.10 The Object-Oriented Paradigm in Perspective
The object-oriented paradigm has to be usedcorrectlyAll paradigms are easy to misuse
When used correctly, the object-oriented paradigmcan solve some (but not all) of the problems of theclassical paradigm
Slide 1.57
© The McGraw-Hill Companies, 2007
The Object-Oriented Paradigm in Perspective (contd)
The object-oriented paradigm has problems of itsown
The object-oriented paradigm is the bestalternative available todayHowever, it is certain to be superceded by something
better in the future
Slide 1.58
© The McGraw-Hill Companies, 2007
1.11 Terminology
Client, developer, user
Internal software
Contract software
Commercial off-the-shelf (COTS) software
Open-source softwareLinus’s Law
Slide 1.59
© The McGraw-Hill Companies, 2007
Terminology (contd)
Software
Program, system, product
Methodology, paradigmObject-oriented paradigmClassical (traditional) paradigm
Technique
Slide 1.60
© The McGraw-Hill Companies, 2007
Terminology (contd)
Mistake, fault, failure, error
Defect
Bug “A bug crept into the code” instead of“I made a mistake”
Slide 1.61
© The McGraw-Hill Companies, 2007
Object-Oriented Terminology
Data component of an objectState variableInstance variable (Java)Field (C++)Attribute (generic)
Action component of an objectMember function (C++)Method (generic)
Slide 1.62
© The McGraw-Hill Companies, 2007
Object-Oriented Terminology (contd)
C++: A member is either anAttribute (“field”), or aMethod (“member function”)
Java: A field is either anAttribute (“instance variable”), or aMethod
Slide 1.63
© The McGraw-Hill Companies, 2007
1.12 Ethical Issues
Developers and maintainers need to beHard workingIntelligentSensibleUp to date and, above all,Ethical
IEEE-CS ACM Software Engineering Code ofEthics and Professional Practicewww.acm.org/serving/se/code.htm