`
buliedian
  • 浏览: 1190519 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

软件工程的基本原则(略译)

阅读更多
Fundamentals of Software Engineering
软件工程的基本原则
摘自《The Art of Software Architecture: Design Methods and Techniques 》
http://as.wiley.com/WileyCDA/WileyTitle/productCd-0471228869.html
刘建文略译(http://blog.csdn.net/keminlau
The main task of engineers, according to Pahl (Pahl, 1996), "is to apply their scientific and engineering knowledge to the solution of technical problems, and then to optimize those solutions within the requirements and constraints set by material, technological, economical, legal, environmental, and human-related considerations." We can extend this definition to define the main task of software engineers. Informally, the main task of software engineers is to apply their logic and programming knowledge to the solution of technical and business problems. Then they optimize those solutions within the requirements and constraints set by logic (the material of software engineering); software technology; and economical, legal, environmental, and safety considerations.
根据Pahl《Engineering Design: A Systematic Approach》上的观点,工程师的主要工作是应用他们的科学的工程的知识去解决技术问题,并且根据各种的需求和限制优化解决方案,各种限制包括原材料的、技术的、经济方面的、合法性上的、环境方面的和人类有关的考虑。我们可以扩展一下这个定义来定义软件工程师的主要工作。非形式地说,软件工程师的主要工作是运用他们的逻辑和编程知识去解决商务问题和技术问题。这些解决方案要满足各种的商务需求和各种限制,如逻辑限制、软件技术限制、经济成本、合法性、环境限制和安全考虑。
The term engineering, as applied to software, is not always entirely appropriate. I think it assumes too broad of a specialty. I think of software development as involving many subdisciplines. These include specialties like database design and implementation, Structured Query Language (SQL), Java, and C++ programming, and eXtensible Stylesheet Language Transformations (XSLT) coding. The specialties can even be finer grained than this. Each of these technologies needs specialists just as there are specialists in established engineering disciplines such as electronic and mechanical engineering. In each of these fields there are further specializations. Yet we treat software development as if it were a single engineering discipline. It is, in fact, several related disciplines. Imagine that a competent developer of XSLT is given very clear specifications, to which a given transformation, or stylesheet, must conform, including well-defined inputs and outputs. The XSLT designer can produce a stylesheet using available tools and methods and possibly reuse parts from an existing library of XSLT. This assumes that we can provide well-defined specifications.
工程这个概念应用于软件开发并不是很合适的。我认为过于宽泛。软件开发涉及了很多的子学科,这些特殊的子学科包括数据库设计和实现、SQL、JAVA、C++编程、XSLT等。每个子学科本身的内容也相当的多,也是一个工程科学。现在我们把软件工程当作似乎是单一的工程学科,实际上软件工程是很多相关的工程学科的混合。

I think that the division of software engineering is probably necessary with some combination of technology (databases, Java) and problem domains. Of course, having specialties with individual techniques, tools, and methods still poses a problem of engineering sophisticated systems that involve integrating these technologies. This is where the software architect comes in. The software architect could be considered a type of software engineer that may not necessarily be a specialist in all of the particular software engineering domains. The software specialist is a specialist in architecture design, and understands the varieties of technology well enough to integrate them into a cohesive solution to a complex problem.
我觉得对软件工程进行技术和问题领域的分解是有必要的。当然,这种分解是有代价的,因为各种独立的技术、工具和方法要集成在一起来解决软件工程问题需要额外的集成知识。这也是软件架构师的职责所在。软件架构师可以理解成一种不必完全掌握所有软件工程子领域的工程师,他们专职于架构设计、了解各种工程技术的区别,从而集成这些技术来解决复杂的工程问题。

It is not uncommon in practice today to divide labor along technology lines. It is common to separate user interface (UI) or presentation development from middle-tier development or back-end development. But without architecture, even this separation of engineering specialties will not necessarily help produce high-quality systems. Some authors argue that this separation (called horizontal slicing) is not necessarily effective and advocates a vertical slicing where each developer owns a set of functional requirements and implements them front to back. Both approaches can be used effectively. It's more a matter of the skills of the individuals together with the technical leadership and project management techniques.
技术工作的分解出现已经相当的常见了。像分离系统的UI、中间层和后端。如果没有架构的分解,大系统的质量没有保证。有一些人认为这种“水平分片”的分解的效率不高,他们提倡垂直的分片,就是每个开发者负责系统的一部分的功能代码的实现,再进一步协作。这两种方法都有效。无论是哪一种,有件东西是很确定的,就是大项目的技术指导和管理提上议程。
The two primary problems in software development that have yet to be solved satisfactorily are making systems cost effective and of higher quality. Improving the productivity of software engineers is an important part of making systems cost effective. Improving the quality of systems is important in order to make them safer and more effective in accomplishing business goals and objectives. Improving the quality of the design of a system also aids in achieving cost-effectiveness. A major obstacle to solving these two problems is the complexity inherent in developing software. This is a result of the complexity of the problems being solved, the wide variety of technologies that may be applied, and the fact that software development is almost purely a design activity. (As opposed to other engineering disciplines of which manufacturing is a major time and cost element of the process, in software even writing code is a design activity and cannot be managed like a manufacturing process.)
软件开发的两大基本问题--系统的成本效益与高质量已经得到很好的控制了。解决这两大问题的主要障碍是软件开发的固有的复杂性。复杂性的根源有,第一,待解决的问题本身的复杂性;第二,可供选择的技术多种多样;第三,软件开发是种纯设计的活动(相对于其它的工程学科,有相对固定的生产时间和生产成本,软件就算写代码也是一种设计工作而无法受生产过程控制)。

Using current methods, technologies, and programming languages, we are able to solve problems to a certain level of complexity. However, to break through the barriers established by the complexity of the problem to build larger systems, we need to evolve our methods and tools. As systems grow in complexity, certain other quality attributes become more relevant; as the size of a system grows, the number of dimensions of the system also grows. In small systems, we can focus on functional correctness and performance. In large systems, we need to address attributes such as portability, security, reliability, and modifiability.
使用目前的技术、方法和编程语言,我们可以解决问题在一定层次水平的复杂性。但是,要解决大系统所面临的问题则需要混合使用所有方法和工具。当系统开始变得复杂,这些系统质量有关的属性变得很很重。在小型的系统,我们可以集中系统功能的正确性和性能,而在大系统我们还得考虑系统的灵活性、安全性、可靠性和可修改性等。

There are several fundamental software engineering techniques that can help improve the quality and cost-effectiveness of software:
  • Reusable assets
  • General-purpose programming languages
  • Special-purpose programming languages
  • Modeling languages and notations
有四种提供软件质量和成本效益的基本技术:
  • 可重用资源
  • 通用编程语言
  • 专用编程语言
  • 建模语言和图形
Reusable Assets
Code reuse improves the productivity of the programmer by shortening the amount of time required to implement some functionality. Of course, there is a trade-off of time spent discovering, learning, and integrating the reusable code, so reusable code needs to be easy to find, quick to learn, and straightforward to integrate. Code reuse manifests itself in the following:
Source code that can be copied and modified to suit or be used as is (for example, C++ algorithms from a shareware repository or copied from a book).
Commercial off-the-shelf (COTS) components that are available in binary (compiled) form and that can be imported or linked to other components or applications. This includes:
Binary code "libraries" that can be linked into a program at compile time or loaded and bound at run time (for example, a sockets library).
Operating environments and platforms (for example, operating systems, databases, application servers).

代码重用提高程序员功能模块的开发效率,当然,部分折衷的时间用在了学习、发现和集成这些可重的代码,所以可重用代码必须设计得易用易学和易集成。代码重用的形式有:
  • 源代码,可以被复制和修改的(像C++算法)直接的源代码
  • 商业(成品)组件,是可被引入和链接的二进制组件,形式包括:
    • 二进制代码“库”,可在编译期链接到新应用或者在运行期进行动态绑定的“库”;
    • 操作环境或平台(例如,操作系统、数据库和应用服务器)

Reusable components, especially ones that address large problem spaces, provide a huge boost in productivity. Imagine if you had to write your own middleware, application server, and database in order to develop a distributed business application. Of course, all of those reusable technologies contain more features than any single application needs but even to develop the subset required by an application is a formidable and time-consuming task.
可重用组件,特别对于定位大问题空间的,在开发效率上提供巨大的的帮助。想像一下,为了开发一个分布式商务应用,没有可重用组件,你得自己开发中间件、应用服务器和数据库。
In order to effectively reuse components, we must be able to express our solution in terms of the abstractions of the component. There are times when a particular abstraction, such as relational entities, doesn't suit all of our needs, just as a natural language may not have words to express certain concepts. So we invent new technologies just as we invent new words. Object-oriented databases are an example of such an invention. When object-oriented programming started to supplant existing structured languages like C and Pascal, a semantic gap was introduced between the representation of information in the programming language and the representation of information in the database. Many papers and books have addressed the object-relational mapping problem. Today we have documented patterns for object-relational mapping that assist us in overcoming this obstacle.
为了更有效的使用可重用组件,我们必须能够使用组件抽象级的词汇来表达我们的解决方案。但是有时我也不得不使用一些意外的抽象词汇,像关系对象,关系对象不能完全混进OO的抽象级别。这就好像自然语言有时无法有一些词语来表达某个概念,所以我用创造新词汇来表达不明概念的方来解决关系对象不能完全混进OO的问题,这就是面向对象数据库。当面向对象语言开始排挤结构化语言,像C和Pascal时,编程语言中表达信息的形式与数据库中的表达信息的形式产生了语义断层。已经有很多论文和图书讨论了这个对象-关系映射问题。现在我们也已经有了详细的模式处理对象-关系映射问题。

General-Purpose Programming Languages
Powerful general-purpose programming languages like C++ and Java provide expressive power for creating solutions to many complex problems by allowing the programmer to focus on the problem at hand and worry less about specific hardware capabilities. General-purpose object-oriented languages don't solve the problem of complexity alone; they must be used in conjunction with guidelines and design patterns. How often have you seen a class that was really just a big collection of structured subroutines, such as the God Class (Riel, 1996)?
通用编程语言,像C++和JAVA的强大在于为开发复杂的应用提供强大的表达能力。通用的面向对象语言本身对处理问题复杂性是有限的,它们必须联合各种模式使用。
Special-Purpose Programming Languages
Some COTS components have specialized programming languages for creating applications or parts of an application. The languages can be easier to use than general-purpose programming languages for specific problems. For example, when using a relational database component a programmer uses Data Definition Languages (DDL) and SQL to implement a data storage and access solution. SQL is specialized for the domain of relational databases. Specialized languages improve productivity by allowing the developer to think in terms of the abstractions of a specific technology (which is a simpler domain to comprehend) rather than by using the same general-purpose language for all programming problems. If a programmer had to understand how the data was stored in files and how the files were indexed, the problem would become much more complex. Of course, specialized languages introduce complexities of their own. The industry addresses this by developing guidelines and design patterns for the effective use of a particular technology. In relational databases, the theory of normal forms was developed to help programmers design databases with certain quality attributes. Other examples of specialized languages are Web presentation technologies such as Active Server Pages (ASP), Java Server Pages (JSP), and Hypertext Preprocessor (PHP), and data representation and transformation languages such as Hypertext Markup Language (HTML), eXtensible Markup Language (XML), and eXtensible Stylesheet Language Transformations (XSLT).
一些商业组件使用了专用语言来开发应用或者开发应用的部分。对于一些特定的问题,专用语言比通用语言更有效。例如,当使用关系数据库组件时,程序员会使用数据定义语言(DDL)和结构化查询语言(SQL)来实现数据存储和访问。SQL是关系数据库领域的特殊语言。专用语言能有效提高开发效率,原因是它为程序员解决特定问题提供了特定的语言词汇。不像通用语言,如果程序员为了使用数据库必须理解数据是如何被保存为文件并且如何被索引,问题就变得很复杂了。当然,专用语言也有它自身的复杂性。业界已经为有效使用专用技术开发出了相关的开发指导和设计模式。如在关系数据库,范式理论为开发者设计数据库提供了指导。

Modeling Languages and Notations
Modeling languages and design notations emerged as methods for improving software design quality. It is argued that an expressive modeling notation can expand our capability to design software much like mathematics allows us to reason about more complex things than our minds would normally be capable of without such a language. The entity relationship diagram (ERD), for example, is a powerful modeling language and notation that allows a software engineer to design and communicate expressive data models. Without such a language, it would be difficult to think about the information design of a system, and without a notation to represent the diagrams, it would be difficult to communicate those designs to others. The formality of the language allows different people to interpret a model in a precise way.

The UML is a rich collection of modeling notations for representing many aspects or views of a software system, including the information and information flow, class structure, and object interactions. The UML and other modeling languages improve a software engineer's individual capacity to create complex solutions. Some UML tools today allow for partial code generation from UML models. It is possible that a language like UML may become a true programming language (either special-purpose or general-purpose) As we have seen in the brief history above, what begins as a notation for representing software design can become the next-generation programming language.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics