软件体系结构 软件生产线 Product Line 孙志岗 sun@hit.edu.cn
The goal of reuse Effective reuse of software has long been a goal of the software engineering community. 高效的重用一直是软件工程界的一个目标 “Buy, don’t build!” “Mine, don’t make!” The theoretical advantages are obvious: Should save time Should save money Should be more reliable Should encourage modular design 2019/2/5 © sun@hit.edu.cn
The elusive goal of reuse The promises of reuse have largely not been met. 重用的豪言壮语大部分没有兑现 If you didn’t build it... How do you find it? How do you know precisely what it does? How do you know that what it does is precisely what you need? How can you trust it? Who do you turn to when needs to be changed? 当需要它改变时,你去找谁? It’s usually easier to build it yourself. 2019/2/5 © sun@hit.edu.cn
Objects to the rescue? The object-oriented world has brought us new ways to reuse software. 面向对象带给我们支持重用的新方法 objects frameworks to some extent, architectures And yet, something is missing. Large-scale object-oriented reuse is also (for the most part) failing to appear. 然而,仍然有问题。大规模的面向对象重用仍然罕见 Why is that? 2019/2/5 © sun@hit.edu.cn
The problem of mismatch In 1972, Parnas wrote that the interface to a module is the set of assumptions a programmer who wants to use it can make about it. 1972年,Parnas的论文中说,一个模块的接口应该是由使用者决定的 In 1997, Garlan et al. wrote about architectural mismatch which repeated the observation tried to build a system out of off-the-shelf parts failed because of subtle assumptions each part made about its environment 在试图使用购买的模块搭建系统时失败了,因为每个模块都对它的运行环境有一些微妙的假想 What went wrong? 2019/2/5 © sun@hit.edu.cn
Objects revisited Reusable objects Reusable frameworks can’t solve the “easier to build than find” problem 不能解决“建造它比发现它更容易” Reusable frameworks Application-specific or domain-specific 针对特殊应用或者特殊领域 Relatively few examples of cross-organizational reuse 难以跨组织重用 Reusable architectures Many examples of cross-organizational reuse 有很多跨组织重用的例子 2019/2/5 © sun@hit.edu.cn
Architecture as a reusable asset An architecture represents a significant investment. Why use it for only one system? 一个体系结构是一个重要投资。怎能只把它用于一个系统? Architecture can form the foundation for a product line that allows competitive advantage in the marketplace. 体系结构作为生产线的基础,使产品在市场上更具有竞争性的优势 Commercial examples include cars commercial aircraft appliances light bulbs 2019/2/5 © sun@hit.edu.cn
Architecture as a reusable asset Product lines built using a common set of assets epitomize strategic, planned reuse. 生产线使用公用的资源构成战略性的、有计划的重用 Individual systems (products) are modifications of a (hypothetical) central core system. 每个独立的系统(产品)修改自一个(假想的)核心系统 Products are produced by tailoring the architecture 剪裁体系结构 instantiating tailorable components 实例化可剪裁的组件 generating, rather than building 产生而不是建造 emphasizing integration, not coding 注重集成而不是编码 我们不是要建立可重用的模块,而是建立按照预先计划的方法可以重用的模块 2019/2/5 © sun@hit.edu.cn
What Is a Product Line? 产品 A product line is a group of products sharing a common, managed set of features that satisfy specific needs of a selected market. 生产线是一组共享公用的、被合理组织的特性的产品,这些特性满足某个市场的特定需求 适合 市场策略 应用领域 产品 接受 共享 体系结构 被用来构造 构造自 组件 2019/2/5 © sun@hit.edu.cn
Product lines built to exploit commonality 2019/2/5 © sun@hit.edu.cn
Built in this way, product lines epitomize strategic reuse Product lines amortize the investment in these and other assets: 生产线分期偿清在下列资源上的投资 requirements and requirements analysis domain models software architecture and design performance engineering documentation test plans, test cases, and data schedules and budgets people: their knowledge and skills processes, methods, tools, and estimates software components and legacy systems 体系结构重用了,架构师就可以解雇了吗? 2019/2/5 © sun@hit.edu.cn
Product line benefits of reuse Defect reduction: defect fixed in one product automatically fixed for all future products 减少缺陷:在一个产品中修正的缺陷,自动在未来的产品中也被修正 Performance: performance issues addressed for all products (e.g., schedulability, deadlock, distributed system issues) 性能:性能问题在所有产品中都被解决 Planning: more accurate because all products are produced in the same way 计划:更准确,因为所有的产品都用相同的方式生产 Reduction in time to market staffing 2019/2/5 © sun@hit.edu.cn
State of Product Line Practice Many organizations have already experienced considerable savings using a product line approach for software system production, or launched product line initiatives. 很多公司已经体验了生产线带来的可观收益,或者已经主动开始启用生产线 Motorola, Ford, Bosch, Toshiba, Hitachi, Ericsson, Philips, Hewlett-Packard, AT&T, Lucent, ALLTEL, Buzzeo, Boeing, Lockheed Martin... 2019/2/5 © sun@hit.edu.cn
A Product Line Case Study: CelsiusTech
CelsiusTech Company Background Swedish defense contractor 瑞典国防部的采购对象 approximately 2000 employees 大约有2000名员工 about $300 million in annual sales 每年销售额大约为3亿美元 Long-time supplier of naval shipboard command and control systems 多年来为海军开发各个系列的舰艇命令和控制系统 2019/2/5 © sun@hit.edu.cn
2019/2/5 © sun@hit.edu.cn
1985: Disaster Struck! CelsiusTech marketers landed two large contracts simultaneously. CelsiusTech的市场人员同时拿到了两个大订单 1,000,000 SLOC each (estimated) greater complexity of requirements than before CelsiusTech realized they could not fulfill both contracts unless they started doing business in a totally new way. CelsiusTech意识到它们不可能同时完成两个合同,除非走一条全新的开发道路 Earlier systems were troublesome to integrate and had cost schedule overruns. 如集成以前的系统会遇到很多棘手的问题,成本和进度超出 Hiring was not an option: there was a shortage of engineers. 不能增加人手:瑞典很缺少软件人员 怎么办? 2019/2/5 © sun@hit.edu.cn
Situation Requirements (Qualities) Technical environment Fault tolerance Real-time Tailorability Asset reuse Time to market Technical environment Ada Object orientation Iterative development Architect’s experience Real-time embedded C3I 2019/2/5 © sun@hit.edu.cn
CelsiusTech’s Response Business strategy create a product family make product scaleable over a wide range of systems 让产品可以适应广泛的系统 Technical strategy create a new generation of system hardware, software supporting development approach configure systems from product family; new projects added to the family 从产品家族配置系统;新的项目加入家族 2019/2/5 © sun@hit.edu.cn
What Was New to CelsiusTech? Everything! Previous Current mini computers microcomputers LAN, autonomous nodes commercial LAN with loosely coupled components RTL/2 Ada waterfall process model prototyping, incremental development structured analysis/design object-oriented analysis/design locally developed environment commercial development environment skills training new organizational structure 面对此情况,你会如何做? 2019/2/5 © sun@hit.edu.cn
What CelsiusTech Did Assembled a small expert architecture team with 组建了一个小型体系结构专家组,拥有 extensive domain knowledge 广阔的领域知识 previous systems experience 原有系统的经验 Objective: produce architecture that would suffice for both systems plus new systems in the same domain. 目标:设计出足以满足这两个系统和在相同领域内的未来新系统的体系结构 2019/2/5 © sun@hit.edu.cn
SS2000 System Architecture 2019/2/5 © sun@hit.edu.cn
Typical System Configuration 15-30 nodes on LAN 30-70个CPU 100-300 Ada programs 1-1.5 million Ada SLOC 所有员工都知道体系结构风格 2019/2/5 © sun@hit.edu.cn
CelsiusTech’s Software Architecture Two dominant styles layered architecture to separate application-specific software from software used across the entire product line 层次体系结构把整个产品线都要用到的软件和针对特殊应用的软件分开 blackboard style to decouple producers and consumers of data 黑板风格来耦合数据的生产者和消费者 Both styles promote modifiability and reusability. 两个风格都促进了适应性和重用性 2019/2/5 © sun@hit.edu.cn
Layered Architecture 2019/2/5 © sun@hit.edu.cn
Runtime Blackboard Architecture 2019/2/5 © sun@hit.edu.cn
Units of Software Ada packages are the smallest units. Ada包是最小的单元 System functions are the basic units of reuse. A system function is a “vertical slice” through the layers that carries out one task. 系统功能是基本的重用单元。一个系统功能解决一个任务,是层次系统的“垂直切片” System function groups are collections of system functions that are always used together. They form basic work assignments for development teams. 系统功能组是经常在一起的系统功能的集合。它们形成了开发组的基本工作分配 System functions and system function groups are large, pre-integrated, testable chunks of the system. 系统功能和系统功能组是大的、预先集成的、可测试的系统模块 bigger is better 2019/2/5 © sun@hit.edu.cn
Units of Software 2019/2/5 © sun@hit.edu.cn
Current Members of Product Family Sold 55 variants in SS2000 product family 瑞典哥德堡级海岸轻型巡洋舰(KKV)(380吨) 丹麦SF300级多用途巡逻舰(300吨) 芬兰饶玛级快速攻击舰(FAC)(200吨) 澳大利亚/新西兰ANZAC护卫舰(3225吨) 丹麦西蒂斯级海洋巡逻舰(2700吨) 瑞典哥特兰岛级A19潜水艇(1330吨) 巴基斯坦21型护卫舰 安曼共和国巡逻船 完全不同的产品,相同的体系结构 2019/2/5 © sun@hit.edu.cn
Result of Changes: Shrinking, Predictable Schedules 2019/2/5 © sun@hit.edu.cn
Result of Changes: Lower Staffing 2019/2/5 © sun@hit.edu.cn
Result of Changes: Reuse 2019/2/5 © sun@hit.edu.cn
Technical Lessons Learned Domain knowledge is a vital asset at the start. 在开始的时候,领域知识生死攸关 Building more than one system in parallel is important. 同时开发一个以上的系统很重要 validates domain knowledge validates architecture Architecture small, focused team (two or three members) 专注的小团队(两个或三个成员) experience with distributed high-performance systems information-hiding/encapsulation parameterized modules large pre-integrated chunks 2019/2/5 © sun@hit.edu.cn
Organizational Lessons Learned A different organizational structure was required: organization divided into two groups. 需要一个不同的组织结构:分成两组 customer projects family-wide components group A technical steering group is needed. 需要一个技术舵手组 keeps product line current in the domain is a catalyst for cross-product line sharing 是跨生产线共享的催化剂 watches for promising technologies Focus on skill development is critical. expertise required in domain, not coding 2019/2/5 © sun@hit.edu.cn
Business Lessons Learned Economic substantial and long-term up-front investment was reduced by using off-the-shelf platforms, components, GUI-builders 采用购买的平台、组件、GUI设计器等降低了长期投资 software-to-hardware cost ratio reversed Customer formation of users groups, as for COTS vendors, to guide evolution of product line 用户组的形成是为了引导产品线的进化 negotiation of customer requirements based on reuse over entire product line 整个产品线用户需求的协商都是基于重用的 perception of lower risk/cost; high confidence 低风险/成本;高信心 2019/2/5 © sun@hit.edu.cn
Feedback Loop CelsiusTech is now exploring other domains in which their architecture and product line approach offers promise. CelsiusTech正在寻找它们的体系结构和产品线可以被应用的其他领域 Air defense sector: Surprise! 40% of brand new system could be lifted verbatim from SS2000. 防空系统:新系统的40%可以从SS2000获得 2019/2/5 © sun@hit.edu.cn
Landing 2019/2/5 © sun@hit.edu.cn
CelsiusTech Today CelsiusTech is now owned by Saab. http://www.saab.se/ Their newest C&C system is the Mk3E 2019/2/5 © sun@hit.edu.cn
2019/2/5 © sun@hit.edu.cn
2019/2/5 © sun@hit.edu.cn