slide 1.1 © center for research in electronic commerce, xiamen university, 2004 object-oriented and...
Post on 22-Dec-2015
216 views
TRANSCRIPT
Slide 1.1
© Center for Research in Electronic Commerce, Xiamen University, 2004
Object-Oriented and Classical Software
Engineering
Fifth Edition, McGraw-Hill, 2002
Slide 1.2
© Center for Research in Electronic Commerce, Xiamen University, 2004
CHAPTER 1
SCOPE OF SOFTWARE ENGINEERING
Slide 1.3
© Center for Research in Electronic Commerce, Xiamen University, 2004
JUST IN CASE YOU WANTED TO KNOW
A well-known story tells of an executive who received a computer-generated bill for $0.00. After having a good laugh with friends about “idiot computers,” the executive tossed the bill away.A month later a similar bill arrived, this time marked 30 days. Then came the third bill. The fourth bill arrived a month later, accompanied by a message hinting at possible
legal action if the bill for $0.00 was not paid at once.
The fifth bill, marked 120 days, did not hint at anything—the message was
rude and forthright, threatening all manner of legal actions if the bill was not immediately paid.
Fearful of his organization’s credit rating in the hands of this maniacal machine, the executive called an acquaintance who was a software
engineer and related the whole sorry story. Trying not to laugh, the software engineer told the executive to mail
a check for $0.00. This had the desired effect, and a receipt for $0.00 was received a few days later. The executive carefully filed it away in case at some future date the computer might allege that $0.00 was still owing.
Slide 1.4
© Center for Research in Electronic Commerce, Xiamen University, 2004
JUST IN CASE YOU WANTED TO KNOW
During the 1991 Gulf War, a Scud missile penetrated the Patriot antimissile shield and struck a barracks near Dhahran, Saudi Arabia. In all, 28 Americans were killed and 98 wounded. The software for the Patriot missile contained a cumulative timing fault. The Patriot was designed to operate for only a few hours at a time, after which the clock was reset. As a result, the fault never had a significant effect and therefore was not detected. In the GulfWar, however, the Patriot missile battery at Dhahran ran continuously for over 100 hours. This caused the accumulated time discrepancy to become large enough to render the system inaccurate.
During the GulfWar, the United States shipped Patriot missiles to Israel for protection against the Scuds. Israeli forces detected the timing problem after only 8 hours and immediately reported it to the manufacturer in the United States. The manufacturer corrected the fault as quickly as it could
but, the new software arrived the day after the direct hit by the Scud.
Slide 1.5
© Center for Research in Electronic Commerce, Xiamen University, 2004
What is software engineering
Whether we are dealing with billing or air defense, much of our software is delivered late, over budget, and with residual faults. Software engineering is an attempt to solve these problems. In other words, software engineering is a discipline whose aim is the production of fault-free software, delivered on time and within budget, that satisfies the user’s needs. Furthermore, the software must be easy to modify when the user’s needs change. To achieve these goals, a software engineer has to acquire a broad range of skills, both technical and managerial. These skills have to be applied not just to programming but to every phase of software
production, from requirements to maintenance.
Slide 1.6
© Center for Research in Electronic Commerce, Xiamen University, 2004
Outline
Historical aspects Economic aspects Maintenance aspects Specification and design aspects Team programming aspects The object-oriented paradigm Terminology
Slide 1.7
© Center for Research in Electronic Commerce, Xiamen University, 2004
Scope of Software Engineering
Historical Aspects– 1968 NATO Conference, Garmisch– Aim: to solve the “Software Crisis”– Software is delivered
» Late» Over budget» With residual faults
Slide 1.8
© Center for Research in Electronic Commerce, Xiamen University, 2004
Scope of Software Engineering (contd)
Why cannot bridge-building techniques be used to build operating systems? – Attitude to collapse– Imperfect engineering– Complexity– Maintenance
Slide 1.9
© Center for Research in Electronic Commerce, Xiamen University, 2004
Conclusion
Software Engineering is not “Engineering”
Slide 1.10
© Center for Research in Electronic Commerce, Xiamen University, 2004
Economic Aspects
Economically viable techniques Coding method CMnew is 10% faster than currently
used method CMold. Should it be used?– Common sense answer
» Of course!
– Software Engineering answer » Consider the effect of CMnew on maintenance
Slide 1.11
© Center for Research in Electronic Commerce, Xiamen University, 2004
Maintenance Aspects
Software Life Cycle– The way we produce software, including
» The life-cycle model» The individuals» CASE tools
Slide 1.12
© Center for Research in Electronic Commerce, Xiamen University, 2004
Life-cycle model
1. Requirements phase :2. Specification phase : what to do?3. Design phase: how to do?4. Implementation phase: Programming and testing5. Integration phase (in parallel with 4)6. Maintenance phase: error correction and software enhancement 7. Retirement
Slide 1.13
© Center for Research in Electronic Commerce, Xiamen University, 2004
Approximate Relative Cost of Each Phase
1976–1981 data Maintenance constitutes 67% of total cost
Slide 1.14
© Center for Research in Electronic Commerce, Xiamen University, 2004
Comparative Relative Cost of Each Phase
Slide 1.15
© Center for Research in Electronic Commerce, Xiamen University, 2004
Good and Bad Software
Good software is maintained—bad software is discarded
Different types of maintenance– Corrective maintenance [about 20%]– Enhancement
» Perfective maintenance [about 60%]» Adaptive maintenance [about 20%]
Effect of CMnew on maintenance– If maintenance cost is reduced about 10%,then total
cost is reduced about 6~7%
Slide 1.16
© Center for Research in Electronic Commerce, Xiamen University, 2004
Specification and Maintenance Faults
60 to 70 percent of faults are specification and design faults
Data of Kelly, Sherif, and Hops [1992]– 1.9 faults per page of specification– 0.9 faults per page of design– 0.3 faults per page of code
Slide 1.17
© Center for Research in Electronic Commerce, Xiamen University, 2004
Specification and Maintenance Faults (contd)
Data of Bhandari et al. [1994] , Faults at end of the design phase of the new version of the product– 13% of faults from previous version of product– 16% of faults in new specifications– 71% of faults in new design
Slide 1.18
© Center for Research in Electronic Commerce, Xiamen University, 2004
Cost to Detect and Correct a Fault
Slide 1.19
© Center for Research in Electronic Commerce, Xiamen University, 2004
Q&A
1. 用于确立内燃机中所用油料最佳粘度的软件产品,在交付产品 15个月后发现一个问题。纠正这个错误的花费大约 18730美元。规格设计文档中的一个模糊语句导致这个错误。估计一下,在规格设计阶段纠正该错误要花费多少钱?
2. 假设错误在实现阶段发现,纠正该错误需要花费多少钱?
3. 如何理解在需求阶段和规格说明阶段发现存在的错误的重要性。在产品还没有生产之前就开始纠正错误,是不是不近合理?
Slide 1.20
© Center for Research in Electronic Commerce, Xiamen University, 2004
Team Programming Aspects
Hardware is cheap– We can build products that are too large to be written
by one person in the available time Teams
– Interface problems– Meetings
Slide 1.21
© Center for Research in Electronic Commerce, Xiamen University, 2004
The Object-Oriented Paradigm
The structured paradigm had great successes initially– It started to fail with larger products (> 50,000 LOC)
Maintenance problems (today, up to 80% of effort)
Reason: structured methods are – Action oriented (finite state machines, data flow
diagrams); or – Data oriented (entity-relationship diagrams,
Jackson’s method);– But not both
Slide 1.22
© Center for Research in Electronic Commerce, Xiamen University, 2004
The Object-Oriented Paradigm (contd)
Both data and actions are of equal importance Object:
– 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.23
© Center for Research in Electronic Commerce, Xiamen University, 2004
Structured versus Object-Oriented Paradigm
Information hiding Responsibility-driven design Impact on maintenance, development
Slide 1.24
© Center for Research in Electronic Commerce, Xiamen University, 2004
Key Aspects of Object-Oriented Solution
Conceptual independence– Encapsulation
Physical independence – Information hiding
Impact on development– Physical counterpart
Impact on maintenance– Independence effects
Slide 1.25
© Center for Research in Electronic Commerce, Xiamen University, 2004
Responsibility-Driven Design
Also called “Design by Contract” Send flowers to your aunt in Iowa City
– Call 1-800-FLOWERS– Where is 1-800-FLOWERS?– Which Iowa City florist does the delivery?– Information hiding
Object-oriented paradigm– “Send a message to a method [action] of an object“
Slide 1.26
© Center for Research in Electronic Commerce, Xiamen University, 2004
Transition From Analysis to Design
Structured paradigm:– Jolt between analysis (what) and design (how)
Object-oriented paradigm:– Objects enter from very beginning
Slide 1.27
© Center for Research in Electronic Commerce, Xiamen University, 2004
Analysis/Design “Hump”
Systems analysis– Determine what has to be done
Design– Determine how to do it– Architectural design—determine modules– Detailed design—design each module
Slide 1.28
© Center for Research in Electronic Commerce, Xiamen University, 2004
Removing the “Hump”
Object-oriented analysis– Determine what has to be done– Determine the objects
Object-oriented design– Determine how to do it– Design the objects
Slide 1.29
© Center for Research in Electronic Commerce, Xiamen University, 2004
In More Detail
Objects enter here
Slide 1.30
© Center for Research in Electronic Commerce, Xiamen University, 2004
Warning
Do not use the object-paradigm to enhance a product developed using the structured paradigm– Water and oil do not mix
Exception: if the new part is totally disjoint– Example: adding a GUI (graphical user interface)
Slide 1.31
© Center for Research in Electronic Commerce, Xiamen University, 2004
Terminology
Quality Program, system, product Methodology, paradigm Method and technique Client, developer, user Bug
– “A bug crept into the code”
instead of
– “I made a mistake”
Slide 1.32
© Center for Research in Electronic Commerce, Xiamen University, 2004
Object-Oriented Terminology
Data component of an object– State variable– Instance variable (Java)– Field (C++)– Attribute (generic)
Action component of an object– Member function (C++)– Method (generic)
Slide 1.33
© Center for Research in Electronic Commerce, Xiamen University, 2004
Object-Oriented Terminology (contd)
C++: A member is either an– Attribute (“field”), or a– Method (“member function”)
Java: A field is either an– Attribute (“instance variable”), or a– Method
Slide 1.34
© Center for Research in Electronic Commerce, Xiamen University, 2004
QA&