Object-Oriented Design Heuristics

Object-Oriented Design Heuristics pdf epub mobi txt 电子书 下载 2026

出版者:Addison-Wesley Professional
作者:Arthur J. Riel
出品人:
页数:400
译者:
出版时间:1996-05-10
价格:USD 64.99
装帧:Hardcover
isbn号码:9780201633856
丛书系列:
图书标签:
  • 面向对象
  • programming
  • 编程
  • Design
  • 软件设计
  • Object-Oriented
  • 软件架构
  • 软件开发
  • Object-Oriented Design
  • Heuristics
  • Programming
  • Design
  • Patterns
  • Software
  • Engineering
  • OOP
想要找书就要到 小美书屋
立刻按 ctrl+D收藏本页
你会得到大惊喜!!

具体描述

Product Description

Here is the first object-oriented development book to provide specific experience-based guidelines to help developers make the right design decisions. This book offers the next step for readers that know the basics of object-oriented development and now need to know if they are doing it right and making the right choices.

From the Inside Flap

In the process of teaching object-oriented analysis, design, and implementation to several thousand students, it became clear to me that the industry was in serious need of guidelines to help developers make proper decisions. Since 1987 I have scoured the literature in search of productivity and complexity metrics that can be applied at different levels of development to improve an object-oriented application. I added my own "homemade" guidelines to those found in the literature and came up with approximately 60 guidelines, several of which are tongue-in-cheek yet no less important than any others. I briefly considered calling them the "Sixty Golden Rules of OOA/D," but I recalled Dykstra's legendary "Goto Considered Harmful" paper, which branded users of goto statements heretics who should be burned at the stake in the company courtyard. That paper was important in that it provided an industry rule that stopped the users of goto statements who were destroying, wittingly or unwittingly, the maintainability of their systems. Unfortunately, the side effect of such a rule was the breeding of a group of pathological authors who, for the past 25 years, have published articles stating that the judicious use of a goto statement in some picky little piece of an application is more readable than a corresponding piece of structured code. Of course, these papers were followed up by a half-dozen rebuttal papers, which were themselves rebutted ad nauseam.

In order to prevent the same pathology from occurring, I refer to these 60 guidelines as "heuristics," or rules of thumb. They are not hard and fast rules that must be followed under penalty of heresy. Instead, they should be thought of as a series of warning bells that will ring when violated. The warning should be examined, and if warranted, a change should be enacted to remove the violation of the heuristic. It is perfectly valid to state that the heuristic does not apply in a given example for one reason or another. In fact, in many cases, two heuristics will be at odds with one another in a particular area of an object-oriented design. The developer is required to decide which heuristic plays the more important role.

This book does not invent yet another object-oriented analysis or design methodology, though the idea of creating "Riel's OOA/D Methodology" was tempting. The industry already has enough methodologies offering similar or overlapping advice, using a completely different vocabulary for common concepts. The typical problem of the object-oriented developer - which has not been seriously addressed - occurs once a design has been completed, regardless of the methodology used. The developer's main question is, "Now that I have my design, is it good, bad, or somewhere in between?" In asking an object-oriented guru, the developer is often told that a design is good when "it feels right." While this is of little use to the developer, there is a kernel of truth to such an answer. The guru runs through a subconscious list of heuristics, built up through his or her design experience, over the design. If the heuristics pass, then the design feels right, and if they do not pass, then the design does not feel right.

This book attempts to capture that subconscious list of heuristics in a concrete list backed up by real-world examples. The reader will become immediately aware that some heuristics are much stronger than others. The strength of a heuristic comes from the ramifications of violating it. The reader does not get a prioritized ordering of the heuristics. It is my feeling that in many cases the sense of priority is defined by a combination of the application domain and the user's needs and cannot be quantified here. For example, a common area of design where two heuristics might request opposite directions are those that trade complexity with flexibility. Ask yourself which attribute a software designer desires most, increased flexibility or decreased complexity, and you begin to see the problem of prioritizing heuristics.

The design heuristics are defined on a backdrop of real-world examples focusing on the area of design to which each heuristic belongs. The foundation of real-world examples provides an ideal vehicle for explaining the concepts of object-oriented technology to the novice. The end result is that this book is appropriate to the newcomer who would like a fast track to understanding the concepts of object-oriented programming without having to muddle through the proliferation of buzzwords that permeates the field. Yet, at the same time, it appeals to the experienced object-oriented developer who is looking for some good analysis and design heuristics to help in his or her development efforts.

The first chapter looks at the motivation for object-oriented programming, starting with several issues which Frederick Brooks argued in his "No Silver Bullet" paper published in 1987 (see reference 1). My perspective on object-oriented programming is that it is a natural progression or evolution from action-oriented development. As software has become more complex, we are required to remove ourselves one more level away from the machine in order to maintain the same grasp we have on the software development process. Just as structured methodologies removed one level from bottom-up programming, object-oriented technology removes one level from structured methodologies. It is not that bottom-up programming or structured methodologies are wrong and object-oriented programming is right. Bottom-up programming is perfectly valid when there exists only 4K of memory to develop, just as structured methodologies are perfectly valid when only 256K of memory exists. With the advent of increasingly cheaper and more powerful hardware, the complexity of software has skyrocketed. Developers of the early 1980s did not have to consider the complexity of graphical user interfaces and multithreaded applications; simpler menu-driven, single-threaded systems were the norm. In the very near future, no one will buy a software product unless it incorporates multimedia with moving video and voice recognition. The more complex systems require a greater level of abstraction, which the object-oriented paradigm provides. This is no revolution in software development; it is simply an evolution.

Chapter 2 discusses the concepts of class and object, the basic building blocks of object-oriented technology. They are viewed as the encapsulation of data and its related behavior in a bidirectional relationship. The notion of sending messages, defining methods, and inventing protocols are explored through real-world examples. This is the first chapter to list heuristics. Given the small subset of the object paradigm with which to work, these heuristics are fairly simple but no less useful than the more complex heuristics of subsequent chapters.

The third chapter examines the difference between an action-oriented topology and an object-oriented topology. The different topologies of these methodologies contain the kernel of truth behind object-oriented development. Action-oriented development focuses largely on a centralized control mechanism controlling a functionally decomposed set of tasks, while object-oriented development focuses on a decentralized collection of cooperating entities. I am convinced that the notion of a paradigm shift is the change in thinking required to move from a centralized to a decentralized control model. The learning curve of object-oriented development is an equally large unlearning curve for those of us reared in the world of action-oriented development. The real world in which we live is more attuned to the object model than to a centralized control mechanism. The lack of a paradigm shift manifests itself in systems that consist of a central godlike object that sits in the middle of a collection of trivial classes. These systems are built by developers stuck in the mindset of an action-oriented topology. This chapter proposes numerous heuristics for developing optimal application topologies.

Chapters 4 through 7 examine each of the five main object-oriented relationships: uses (Chapter 4); containment (Chapter 4); single inheritance (Chapter 5); multiple inheritance (Chapter 6); and association (Chapter 7) through a series of real-world examples. Most of the heuristics of interest to the object-oriented designer can be found in these chapters. The chapters on inheritance include many examples of the common misuses of the inheritance relationship. This information is vital in reducing the proliferation of classes problem, such as designing too many classes for a given application. The class proliferation problem is a major cause of failure in object-oriented development.

Chapter 8 examines the role of class-specific data and behavior, as opposed to object-specific data and behavior. The invoice class is used as an example of an abstraction that requires class-specific data and behavior. Both the SmallTalk metaclass and the C++ keyword mechanisms are illustrated. In addition, the notion of C++ metaclasses (i.e., templates) is compared and contrasted to the SmallTalk notion

《面向对象设计原则探微》 在软件开发的漫漫长河中,面向对象(Object-Oriented, OO)范式以其独特的魅力,深刻地改变了我们构建复杂系统的路径。它倡导将现实世界的事物抽象为对象,对象之间通过交互协作,共同完成预期的功能。然而,仅仅理解面向对象的概念和语法,远不足以应对实际开发中错综复杂的设计挑战。优秀的设计,往往蕴含着诸多精妙的原则和实用的技巧,它们如同暗藏的宝藏,等待着开发者去发掘和运用。 《面向对象设计原则探微》并非一本枯燥的理论手册,而是一本旨在引领读者深入理解并熟练掌握面向对象设计精髓的实践指南。本书将带领您穿越抽象的思维殿堂,走进充满智慧的实践领域,探索那些经过时间考验、被无数成功项目所验证的设计“启发式”原则。这些原则,并非生硬的规则,而是经验的沉淀,是开发者在面对具体设计问题时,能够迅速定位方向、做出明智抉择的“捷径”和“线索”。 本书将从多个维度深入剖析面向对象设计的核心要素,帮助您构建出更具可维护性、可扩展性、可重用性和高内聚、低耦合的优秀软件系统。我们将首先回顾面向对象设计的基石,如封装、继承、多态等,但本书的重点将超越这些基础概念,直击设计中更深层次的考量。 您将了解到如何通过精巧的类划分,使每个类承担单一、明确的职责,从而提高代码的可读性和可维护性。我们将深入探讨“单一职责原则”(SRP)的实际应用,理解为何一个类不应承担过多的责任,以及如何识别和重构违反SRP的代码。 接着,我们将聚焦于类之间的关系,特别是“开放-封闭原则”(OCP)。本书将详细阐述如何设计能够“对扩展开放,对修改封闭”的系统,这意味着在不改变现有代码的情况下,能够轻松地为系统添加新功能,从而极大地降低了维护成本和引入错误的风险。您将学会如何利用抽象和接口来达成这一目标。 此外,本书还将深入讨论“里氏替换原则”(LRP),确保子类能够无缝替换其父类,而不会破坏程序的正常运行。我们将通过丰富的实例,展示如何避免“继承的陷阱”,设计出健壮的继承体系。 “依赖倒置原则”(DIP)将是本书另一项重要的探讨内容。我们将揭示高层模块不应依赖于低层模块,两者都应依赖于抽象的奥秘。通过理解和应用DIP,您将能够构建出更加灵活和松散耦合的系统,使得模块之间的替换和重构变得更加容易。 “接口隔离原则”(ISP)也将占据重要篇幅。本书将阐释为何不应该强迫客户端依赖于它们不使用的接口,以及如何通过设计更小的、更精细的接口来提高系统的内聚性。 除了这些核心的SOLID原则之外,本书还将触及一系列重要的设计启发式。您将学习到如何运用“好名字”的原则,赋予类、方法和变量清晰、准确的名称,这如同为代码注入灵魂,极大地提升了代码的可读性。我们将探讨“避免过早优化”的智慧,理解何时应该关注性能,何时应该优先保证代码的清晰和正确性。 本书还将引导您审视“信息隐藏”的重要性,如何通过封装来保护对象的内部状态,减少外部的依赖,从而提升代码的安全性和可维护性。您将了解到如何合理地暴露接口,而将实现细节隐藏起来。 我们还将深入分析“聚合”与“组合”的区别与应用,理解它们在表达对象间“has-a”关系时的细微差别,以及如何根据具体场景选择最合适的关联方式。 《面向对象设计原则探微》强调的是一种思考方式,一种解决问题的哲学。它不仅仅是关于代码的编写,更是关于如何构建一个能够适应未来变化的、易于理解和维护的软件生命体。本书的语言风格将力求平实易懂,结合大量实际的、具有代表性的代码示例,将抽象的设计理念具象化。每个章节的结尾,都会有相应的思考题或小练习,帮助您巩固所学,并将理论知识转化为实践能力。 无论您是刚接触面向对象设计的初学者,还是已经拥有丰富经验的资深开发者,本书都将为您提供宝贵的见解和实用的工具。它将帮助您摆脱“代码腐烂”的泥潭,迈向设计优雅、质量卓越的软件工程新境界。通过本书的学习,您将能够更自信地应对复杂的软件设计挑战,构建出真正能够经受住时间考验的优秀软件。

作者简介

目录信息

读后感

评分

前些日子,公司的老大向我们的Tech Lead推荐了这本书,一看封面怎么这么熟悉,隐约还记得大学的时候在图书馆拿起又放下几次,可惜当时功力不够,根本无法读懂。如是到网上一搜,已经绝版,跑到淘宝上买了本复印版(我也不想买盗版啊,可惜已经绝办了)。 这几日在地铁上几乎都...  

评分

面向对象经典书籍,一书在手,其他的书籍可以不用读了. 唯一的缺点在于其中的C++的问题就用了一半的内容,这部分内容很明显是多余的.

评分

面向对象经典书籍,一书在手,其他的书籍可以不用读了. 唯一的缺点在于其中的C++的问题就用了一半的内容,这部分内容很明显是多余的.

评分

前些日子,公司的老大向我们的Tech Lead推荐了这本书,一看封面怎么这么熟悉,隐约还记得大学的时候在图书馆拿起又放下几次,可惜当时功力不够,根本无法读懂。如是到网上一搜,已经绝版,跑到淘宝上买了本复印版(我也不想买盗版啊,可惜已经绝办了)。 这几日在地铁上几乎都...  

评分

面向对象经典书籍,一书在手,其他的书籍可以不用读了. 唯一的缺点在于其中的C++的问题就用了一半的内容,这部分内容很明显是多余的.

用户评价

评分

我一直认为,优秀的设计是优秀软件的基石,而《Object-Oriented Design Heuristics》这本书,正是帮助我们构筑坚实设计基石的宝贵资源。它没有那种枯燥乏味的理论堆砌,而是通过大量生动、贴切的案例,将抽象的设计理念具象化。书中对“不变性”的推崇,让我对如何构建更健壮的系统有了更深的理解。它解释了为什么在很多情况下,避免可变状态能够极大地简化代码的逻辑,减少潜在的错误。我以前可能不太重视这一点,认为很多时候修改对象状态是自然的。但通过书中对“副作用”的剖析,我开始意识到,过度的状态修改是导致程序行为难以预测的根源之一。此外,书中关于“接口隔离原则”的阐释也尤为精彩。它不仅仅是简单的“不应强迫客户端依赖于它们不使用的接口”,而是通过更深层次的分析,揭示了接口设计对系统解耦和可扩展性的关键作用。读完这本书,我感觉自己对面向对象设计的理解,从“会写类”提升到了“会设计类”,从“满足需求”提升到了“构建可持续演进的系统”。它是一本值得反复阅读、并从中汲取智慧的经典之作。

评分

坦白讲,这本书的某些观点初读时可能会让人感到有些“颠覆”。作者在书中提倡的一些“反直觉”的设计方法,经过深入思考后,却能发现其背后深刻的逻辑。例如,书中关于“命名”的章节,我以为只是简单的“起好名字”而已,但作者却将其上升到了“意图表达”的高度,详细阐述了如何通过命名来清晰地传达类的职责和行为,以及这对于代码可读性和可维护性的重要性。这让我重新审视了自己写代码时对命名的随意性,意识到一个好的名字,远比一段冗长的注释更能说明问题。此外,书中对“复杂性管理”的探讨也令我印象深刻。它不仅仅停留在对复杂性的识别,更重要的是提供了多种行之有效的策略来降低和控制复杂性。这些策略并非抽象的理论,而是可以直接应用到日常的开发实践中。比如,关于“隐藏实现细节”的讨论,作者通过大量案例说明了封装的重要性,以及如何通过良好的接口设计来解耦模块。这本书的优点在于,它不是那种读完就忘的“速食”读物,而是会让你在反复品味中,不断获得新的启发。它就像一本武功秘籍,虽然初看招式简单,但其中蕴含的内功心法,需要反复揣摩才能领会。

评分

对于希望提升自身设计能力的开发者来说,《Object-Oriented Design Heuristics》无疑是一本值得深入研读的著作。作者以一种非常“工程师”的视角,将抽象的设计原则转化为一系列具体的“启发式”建议。我尤其欣赏书中对“可测试性”的强调。在很多设计讨论中,可测试性常常被作为一个独立的话题来处理,而这本书却将其融入到了面向对象设计的核心原则之中。它指出,好的设计本身就应该是易于测试的,反之,难以测试的设计往往也存在结构性问题。这让我开始反思,在以往的设计中,是否过于关注功能的实现,而忽略了代码的可测试性,从而导致了日后维护和迭代的困难。书中关于“减少类之间的交互”的原则,也给了我很大的启发。过去,我可能会倾向于将更多的功能集成到一个类中,认为这样可以简化调用,但结果往往是类的职责过于臃肿,难以理解和修改。这本书则让我意识到,通过将复杂的功能分解到多个小的、职责清晰的类中,并合理设计它们之间的交互,反而能提高整体系统的灵活性和可维护性。它提供了一种更系统、更全局的视野来看待软件设计。

评分

《Object-Oriented Design Heuristics》这本书,单看书名就足以让人眼前一亮,它触及了一个核心痛点:在面对复杂软件系统时,我们常常会陷入“该怎么设计?”的困境。作者并没有提供一套僵化的、放之四海而皆准的“银弹”方法,而是提供了一系列“启发式”的原则,这些原则更像是经验的提炼,是指导我们进行有效设计的智慧结晶。阅读过程中,我最大的感受就是,它给了我一个思考的框架,一个审视自己设计决策的尺度。很多时候,我们之所以写出难以维护、难以扩展的代码,并非技术能力不足,而是设计理念的模糊。这本书恰恰填补了这一空白,它引导我去思考“为什么”要这样做,而不是仅仅停留在“怎么”做。书中对各种设计陷阱的剖析,以及如何规避它们的具体建议,都非常具有实操性。举个例子,关于“组合优于继承”的讨论,虽然在很多地方都有提及,但这本书将其延展开来,深入分析了在不同场景下,组合的灵活性如何能够避免继承带来的耦合过紧和难以修改的问题。读完之后,我发现自己看待类之间的关系,尤其是继承的使用,都有了更审慎的态度。它让我意识到,好的设计并不是一蹴而就的,而是在不断权衡和取舍中形成的,而这些“启发式”原则,就是帮助我们做出明智取舍的指南针。

评分

我必须说,这本书简直是为我这样的开发者量身定做的。在项目开发过程中,我常常会遇到一些棘手的设计问题,比如如何让模块之间的依赖降到最低?如何才能让代码在未来更容易修改?以往我更多地是依靠直觉或者模仿别人的代码,但这种方式往往导致“踩坑”之后才恍然大悟。而《Object-Oriented Design Heuristics》就像一位经验丰富的老者,用通俗易懂的语言,分享了他多年的宝贵经验。《何谓“高内聚,低耦合”?》,这个看似老生常谈的概念,在书中被拆解成了具体的、可执行的“启发式”原则,并且给出了大量的实际例子来佐证。我特别喜欢书中关于“避免过早优化”和“延迟决策”的讨论。过去,我常常因为担心未来的性能问题,而过早地引入复杂的优化,结果往往是适得其反,增加了代码的复杂性,却并没有带来显著的性能提升。这本书让我认识到,在设计之初,更重要的是保持系统的简洁和易于理解,等到真正遇到瓶颈时,再去针对性地优化。它教会我如何用一种更具战略性的眼光来审视设计,而不是被眼前的技术细节所束缚。这本书不仅仅是关于面向对象设计,更是关于如何成为一个更优秀的软件工程师。

评分

评分

评分

评分

评分

本站所有内容均为互联网搜索引擎提供的公开搜索信息,本站不存储任何数据与内容,任何内容与数据均与本站无关,如有需要请联系相关搜索引擎包括但不限于百度google,bing,sogou

© 2026 book.quotespace.org All Rights Reserved. 小美书屋 版权所有