1、软件工程全册配套最完整精品课件软件工程全册配套最完整精品课件2 Software Engineering Introduction Total32 References: 软件工程 - 理论与实践(第四版 影印版) Software Engineering: Theory and Practice 软件工程实践者的研究方法 Software EngineeringPractitioners Approach Research Papers Science, Technology and Engineering Science and Technology 对象不一样 科学的对象是自然界,技术的
2、对象是人造物。 前者是求知,是认识世界,后者是改造世界。 形态不一样 科学一般表现为知识形态,理论形态; 技术则一般表现为物质形态。 Science and Technology 任务不一样 科学要解决“是什么”、“为什么”的问题; 技术回答的是 “做什么”、“怎么做”。 目的不一样 科学的目的是现象之中求本质,以认识课题为己任; 技术是来自某种认识或者经验的升华,用于改造课题的 活动。 Engineering 工程是利用科学知识、方法和手段来 改造自然,让自然为人类服务。 科学家发现自然中的规律和现象; 工程师能制造出一个人为的世界来。 计算机学科发展和分支学科的划分 计算机科学(Compu
3、ter Science) 计算机工程(Computer Engineering) 软件工程(Software Engineering) 信息技术(Information Technology) 信息系统(Information System) 1计算机科学(Computer Science) 计算机科学研究的范围很广,从理论和算法基 础到机器人开发、计算机视觉、智能系统、生物信 息等。主要包括: 寻找求解计算问题的有效方法 构建使用计算机的新方法 软件的设计与实现 2计算机工程(Computer Engineering) 设计和构建计算机系统和基于计算机的系统,包 括研究硬件、软件、通信以及它
4、们之间的交互。 学科内容集中在传统的电子工程、数学等相关领域的理 论、原理和实践。 强调的是硬件而不是软件,而且具有很强的工程特性。 3软件工程(Software Engineering) 软件工程的主要目标是开发系统模型和按时并 在有限预算下生产高质量软件。 软件工程寻找计算机科学中科学与工程原理的结合,探 讨以工程的规范有效地开发和管理软件系统。 4信息技术(Information Technology) 信息技术主要用于管理和处理信息所采用的各 种技术的总称。 它主要是应用计算机科学和通信技术来设计、开发、安 装和实施信息系统及应用软件。 与信息系统学科的重点在于“信息”相对,信息技术学
5、 科的重点在于“技术”。 5信息系统(Information System) 信息系统学科可以理解为是基于技术的商务开发 该学科强调信息技术中的“信息”,而将“技术”看成 是产生、处理和分发所需的工具。 面对的信息系统一般都是庞大和复杂的,既要懂技术, 又要明白组织因素,知道如何有效地利用这类系统。 2014 新一代信息 ? 技术 互联网 嵌入系统 传感器 网络技术 数据库 移动技术 并行计算 互联网技术 移动通信技术 Web技术 互联网 通信技术 电视和计算机 硬件技术 设计和应用 80%以上靠的 是软件 新一代信息技术 是一个复合技术,是一个交叉学科 的综合体 软件工程将如何 The co
6、urse addresses: 1.Why software engineering ? 2.What should we do in software engineering? 3.How do we get to this future of software engineering? The course covers: 1. Traditional software engineering 2. Requirement Analysis 3. Component-based Software Engineering 4. Software Reuse 5. Service-orient
7、ed Software Engineering 6.Aspect-oriented Software Engineering 7. Search-based Software Engineering 8. Empirical Software Engineering An Introduction to Software Engineering Objectives To introduce software engineering and to explain its importance To set out the answers to key questions about softw
8、are engineering To introduce ethical and professional issues and to explain why they are of concern to software engineers FAQs about software engineering What is software? Program? Program = Data Structure + Algorithm Software = Program ? Programs + Associated documentation such as requirements, des
9、ign models and user manuals. What is software? Software products may be developed for a particular customer or may be developed for a general market. Software products may be Generic - developed to be sold to a range of different customers e.g. PC software such as Excel or Word. Bespoke (custom) - d
10、eveloped for a single customer according to their specification. How to produce software? New software can be created by Developing new programs Configuring generic software systems Reusing existing software Software What software have you used? Software Surrounds Our Civilization What Does This Mea
11、n? Software is getting more important Software How do you use these software? Software Software products are large and complex Development requires analysis and synthesis Analysis: decompose a large problem into smaller, understandable pieces abstraction is the key The analysis process Software Soft
12、ware products are large and complex Development requires analysis and synthesis Analysis: decompose a large problem into smaller, understandable pieces abstraction is the key Synthesis: build (compose) a software from smaller building blocks composition is challenging The synthesis process To solve
13、problem Method(Technique): refers to a formal procedure; a formal “recipe” for accomplishing a goal that is typically independent of the tools used Tool: an instrument or automated system for accomplishing something in a better way Procedure: a combination of tools and techniques to produce a produc
14、t Paradigm: philosophy or approach for building a product (e.g., OO vs structured approaches) What is software engineering? Software engineering is an engineering discipline that is concerned with all aspects of software production. Software engineers should adopt a systematic and organised approach
15、 to their work and use appropriate tools and techniques depending on the problem to be solved, the development constraints and the resources available. CS and SE Computer Science: focusing on computer hardware, compilers, operating systems, and programming languages; Computer science is concerned wi
16、th theory and fundamentals. Software Engineering: a discipline that uses computer and software technologies as a problem-solving tools; Software engineering is concerned with the practicalities of developing and delivering useful software. Science, Technology and Engineering Relationship between CS
17、and SE How Successful Have We Been? Perform tasks more quickly and effectively Word processing, spreadsheets, e-mail Support advances in medicine, agriculture, transportation, multimedia education, and most other industries Many good stories However, software is not without problems Northeast Blacko
18、ut of 2003 508 generating units and 256 power plants shut down Affected 10 million people in Ontario, Canada Affected 40 million people in 8 US states Financial losses of $6 Billion USD The alarm system in the energy management system failed due to a software error and operators were not informed of
19、 the power overload in the system Apple 2014 发布会 How Successful Have We Been? A fault: occurs when a human makes a mistake, called an error, in performing some software activities A failure: is a departure from the systems required behavior How Successful Have We Been? Reliability constraints have c
20、aused cancellation of many safety critical systems Safety-critical: something whose failure poses a threat to life or health What Is Good Software? The transcendental view: quality is something we can recognize but not define The user view: quality is fitness for purpose The manufacturing view: qual
21、ity is conformance to specification The product view: quality tied to inherent product characteristics The value-based view: depends on the amount the customers is willing to pay for it What is Good Software Engineering? Good software engineering must always include a strategy for producing quality
22、software Three ways of considering quality The quality of the product The quality of the process The quality of the product in the context of the business environment What Is Good Software? Users judge external characteristics (e.g., correct functionality, number of failures, type of failures) Desig
23、ners and maintainers judge internal characteristics (e.g., types of faults) Thus different stakeholders may have different criteria Need quality models to relate the users external view to developers internal view What Is Good Software? McCalls quality model What Is Good Software? Quality of the dev
24、elopment and maintenance process is as important as the product quality The development process needs to be modeled Modeling will address questions such as Where to find a particular kind of fault How to find faults early How to build in fault tolerance What are alternative activities What Is Good S
25、oftware? Models for process improvement SEIs Capability Maturity Model (CMM) ISO 9000 Software Process Improvement and Capability dEtermination (SPICE) What Is Good Software? Business value is as important as technical value Business value (in relationship to technical value) must be quantified A co
26、mmon approach: return on investment (ROI) ROI is interpreted in different terms: reducing costs, predicting savings, improving productivity, costs (efforts and resources) Who Does Software Engineering? Customer: the company, organization, or person who pays for the software system Developer: the com
27、pany, organization, or person who is building the software system User: the person or people who will actually use the system Who Does Software Engineering? Participants (stakeholders) in a software development project System Approach VS Engineering Approach Software Engineering and System Engineeri
28、ng System engineering is concerned with all aspects of computer-based systems development including hardware, software and process engineering. Software engineering is part of this process concerned with developing the software infrastructure, control, applications and databases in the system. Syste
29、m engineers are involved in system specification, architectural design, integration and deployment. System Approach Hardware, software, interaction with people Identify activities and objects Define the system boundary Consider nested systems, systems interrelationship System Approach Activities and
30、 objects An activity is an event initiated by a trigger Objects or entities are the elements involved in the activities Relationships and the system boundaries A relationship defines the interaction among entities and activities System boundaries determine the origin of input and destinations of the
31、 output System Approach A computer system must also be clearly described System definition of a paycheck production System Approach Some systems are dependent to other systems The interdependencies may be complex It is possible for one system to exist inside another system If the boundary definition
32、s are detailed, building a larger system from the smaller ones is relatively easy System Approach A layered system Engineering Approach Requirement analysis and definition System design Program design Writing the programs Unit testing Integration testing System testing System delivery Maintenance Me
33、mbers of the Development Team Requirement analysts: work with the customers to identify and document the requirements Designers: generate a system-level description of what the system is supposed to do Programmers: write lines of code to implement the design Testers: catch faults Members of the Deve
34、lopment Team Trainers: show users how to use the system Maintenance team: fix faults that show up later Librarians: prepare and store documents such as software requirements Configuration management team: maintain correspondence among various artifacts Members of the Development Team Typical roles p
35、layed by the members of a development team How Has Software Engineering Changed? Before 1970s Single processors: mainframes Designed in one of two ways as a transformation: input was converted to output as a transaction: input determined which function should be performed After 1970s Run on multiple
36、 systems Perform multi-functions Wassermans Seven Key Factors Critically of time-to-market Shifts in the economics of computing Availability of powerful desktop computing Extensive local- and wide-area networking Availability and adoption of object-oriented technology Graphical user interfaces Unpre
37、dictability of the waterfall model of software development Wassermans Seven Key Factors The key factors that have changed the software development Wassermans Discipline of Software Engineering Abstractions Analysis and design methods and notations User interface prototyping Software architecture Sof
38、tware process Reuse Measurement Tools and integrated environments 北山愚公者,年且九十,面山而居。惩 (chng)山北之塞(s),出入之迂(y)也。聚 室而谋曰:“吾与汝(r)毕力平险,指通豫南,达于 汉阴,可乎?”杂然相许。其妻献疑曰:“以君之力, 曾(cng)不能损魁(ku)父(f)之丘,如太行、王 屋何?且焉置土石?”杂曰:“投诸渤海之尾,隐土 之北。”遂率子孙荷(h)担者三夫,叩(ku) 石垦壤,箕畚(j bn)运于渤海之尾。邻人京城氏 之孀(shung)妻有遗男,始龀(chn),跳 往助之。寒暑易节,始一反焉。 惩山北
39、之塞,出入之迂也 原始需求 聚室而谋曰 项目沟通 毕力平险,指通豫南,达于汉阴 项目的目标 技术方案 扣石垦壤,箕畚运于渤海之尾 项目人员 率子孙荷担者三夫 外协人员 邻人京城氏之孀妻有遗男,始龀,跳往助之 编程的根本 河曲(q)智叟(su)笑而止之曰:“甚矣,汝 之不惠(hu)!以残年余力,曾不能毁山之一毛, 其如土石何?”北山愚公长息曰:“汝心之固,固 不可彻(ch),曾不若孀妻弱子。虽我之死,有子 存焉;子又生孙,孙又生子;子又有子,子又有孙; 子子孙孙无穷匮(ku)也,而山不加增,何苦而 不平?”河曲智叟(su)亡(w)以应。 顺 序 。 条 件 虽我之死,有子存焉 循 环 子又生孙,
40、孙又生子;子又有子,子又有孙; 子子孙孙无穷匮也,而山不加增,何苦而不 平? Software Engineering WEI ZHENG (郑炜) Review: 1.What is software? programs + documentation 2. What is software engineering? Science, Technology and Engineering 3. Computer Science and Software Engineering 4.What Is Good Software (Engineering)? 5. How Has Software
41、 Engineering Changed? 描述你早上去上课或者上班的工序过程,并画一个图来 表达这个过程。 当回答这个问题时,考虑过程的定义。你的答案应该包 括以下: the activities involved 涉及到的活动 the steps required to complete the tasks 完成任务所 需要的步骤 the inputs and outputs to each activity 每个事件的输 入和输出 the constraints involved 涉及到的约束 RUP: Rational Unified Process Rational统一过程(软件开发
42、统一过程) Rational 统一过程是由Rational (IBM)软件公 司开发和营销的一种软件工程过程,是开发组织 用以分配与管理任务和职责的一种规范化方法。 这个过程的目的是: 在预定的进度和预算范围内,开发出满足最终 用户需要的高质量软件。 RUP: Rational Unified Process 尝试从传统软件过程中挖掘最好的特征和性质。 用例驱动,以架构为核心,迭代且增量。 对未来变更的可适应性以及复用。 UML建模技术 最佳软件开发实践 Best Practices Develop Iteratively 迭代地开发软件 Manage Requirements 管理需求 Us
43、e Component Architectures 应用基于构件的架构 Model Visually (UML) 为软件建立可视化的模型 Continuously Verify Quality 不断地验证软件质量 Manage Change 控制软件的变更 RUP动态结构 初识阶段 细化阶段 构造阶段 移交阶段 每个阶段包含一个或多个迭代 RUP的核心 RUP核心是解决可操作性问题,帮助开发人员尽 可能少地依赖那些“不可描述的经验”。 它详细给出了 每个阶段参与该过程的各种角色, 该角色在该过程中的产出。 RUP的核心 1. 尽早并且持续的化解重大风险:风险列表是不 断变化的,要持续不断的化解
44、风险。 2. 确保满足客户需求:用例驱动 用例的主要优势是使团队成员在设计、实现、 测试和最终编写用户手册的过程中以用户需求为 中心。 3. 把注意力放在可执行软件上 可执行软件使项目进度的最好体现。对项目进 度评估时,尽可能以正在编写以及正在运行的 代码和通过测试的用例为标准。 RUP的核心 4. 尽早在项目中适应变化 rup要求在初识阶段结束时达成对系统总体外貌 的共识,在细化阶段结束时候建立系统构架的 基线(设计、实现、测试的构架),在构造阶 段结束时候完成特性冻结。 5. 在早期确定一个可执行的构架(architectural) 确立了系统的构架,就识别出了在创建系统时 候会遇到的许多
45、最复杂的困难。 rup 4个主要建模元素: Role 角色:who Activity 活动:how 例如 用例分析,用例设计 Artifact 制品:what 例如 用例实现,模型,文档, 源代码,可执行体 Workflow 工作流:when 例如 顺序图 RUP分析设计步骤 1. 创建Actors; 2. 创建Use Cases,并描述每个Use Case(功能描 述); 3. 创建Sequence Diagrams, Statechart Diagrams, 得到系统Objects; 4. 从Sequence Diagrams分析出的Objects入手, 创建系统Classes和Packa
46、ges; RUP分析设计步骤 5. 为Classes添加Property和Methods,并画出 Class Diagrams,细化类设计。 6. 为Sequence Diagrams中Objects指定对应 Class; 7. 设计系统实现结构,为各个Classes和 Packages指定实现的Component,并画出初步 Component Diagrams。 RUP特点 用例驱动(Use Case) 以体系结构为中心(高内聚低耦合) 增量和迭代开发 用例驱动 用Use Case作为划分问题的组织单元,分析和设 计活动的局部粒度都遵循这一划分原则。 Use Case的定义反映系统外部要素
47、根据特定目标 使用拟建系统的状况,能确保问题的局部划分粒度 适当,保持了全局与局部的平衡。 以体系结构为中心 确保方案从一开始就具备高内聚低耦合可持续增长架构 增量和迭代开发 基于风险前驱的原则,渐进地展开分析、设计及其 相关活动,每个迭代都会提供一次验证和调整模型 机会,推动软件质量的提升。 Unified Modeling Language UML UML Unified Modeling Language 统一建模语言 是一种建模语言 是用来为面向对象开发系统的产品进行说明可 视化和编制文档的方法 UML 的目标 易于使用,表达能力强,可视化建模 与具体的实现无关,可应用于任何语言平台和
48、工 具平台 与具体的过程无关,可应用于任何软件开发过程 简单并且可扩展,具有扩展和专有化机制,便于 扩展,无需对核心概念进行修改 强调在软件开发中对架构框架模式和组件的重用 UML 的架构 UML 是由图和元模型组成. 图(Diagram)是UML 的语法 元模型(meta model)则给出的图的意思是UML 的语义 UML 的语义是定义在一个四个抽象级建模概念 UML UML模型图(5类,10种): 用例图 静态图(类图,对象图,包图) 行为图(状态图,活动图) 交互图(顺序图,合作图) 实现图(构件图,配置图) Use Case Diagram(用例图) 从本质上将,一个用例是用户与计算
49、机之 间为达到某个目的的一次典型交互作用: 用例描述了用户提出的一些可见的需求; 用例可大可小; 用例对应一个具体的用户目标 Use Case Diagram(用例图) 用例图描述系统外部的执行者与系统的用例 之间的某种联系。 所谓用例是指对系统提供的功能(或称系统的用 途)的一种描述; 执行者是那些可能使用这些用例的人或外部系统; 用例和执行者之间的联系描述了“谁使用哪个用 例”。 Use Case Diagram(用例图) 用例图着重于从系统外部执行者的角度来描述 系统需要提供哪些功能,并且指明了这些功能 的执行者是谁; 用例图在UML方法中占有十分重要的地位,人 们甚至称UML是一种用例
50、图驱动的开发方法。 Use Case Diagram(用例图) 设置边界 贸易经理 风险分析 更新帐目 记帐系统 使用 使用 评价交易估计 营销人员 进行交易 扩展 超越边界 销售人员 Class Diagram(类图) 在面向对象的建模技术中,类、对象和它们之 间的关系是最基本的建模元素。对于一个想要 描述的系统,其类模型、对象模型以及它们之 间的关系揭示了系统的结构。 类图描述了系统中的类及其相互之间的各种关 系,其本质反映了系统中包含的各种对象的类 型以及对象间的各种静态关系(关联,子类型)。 Class Diagram(类图) 订单* DateReceived isPrepaid nu