Skip to Content
面向对象的思考过程(原书第5版)
book

面向对象的思考过程(原书第5版)

by 马特 魏斯费尔德
August 2021
Intermediate to advanced
450 pages
4h 46m
Chinese
Pearson
Content preview from 面向对象的思考过程(原书第5版)

第10章 设计模式

软件开发的有趣之处在于当设计软件系统时,实际上是在对现实世界系统进行建模。例如在信息技术领域,可以说IT等同于业务,或者至少说IT实现了业务。为了编写业务软件系统,开发人员必须彻底理解业务模型。结果开发人员往往非常熟悉公司业务方面的知识。

其实对现实世界进行建模这一概念贯穿本书。例如,当我们讨论使用继承来抽象出哺乳动物的行为和属性时,该模型基于现实世界中的模型,而不是出于自身目的刻意创建的模型。

因此,如果创建了一个哺乳动物(mammal)类,可以使用其衍生出无数个其他类,比如猫和狗等。因为所有的哺乳动物都共享某些行为和属性。狗、猫、松鼠以及其他哺乳动物时都可以使用这个类,因为它们都符合一种模式。我们可以借助这个模式审查一个对象来确定它究竟是哺乳动物还是爬行动物,而爬行动物有符合某些其他行为和属性的模式。

纵观历史,模式被应用到了生活中的很多方面,比如工程方面。这些模式将软件开发领域中的软件重用升华到了一个新的高度。本章我们会讲述设计模式,这是软件开发中一个相对较新的领域(关于设计模式的开创之书发布于1995年)。

设计模式大概是过去几年中面向对象运动带来的最具影响力的开发活动之一。模式本身可以完美地融入可重用的软件开发过程中。因为面向对象开发目的就是为了重用,而模式和面向对象的开发关系密切。

设计模式的基本概念就是最佳实践的指导原则。最佳实践是指当创建了优秀和有效的解决方案时,这些解决方案会被记录下来,其他人可以从之前的成功中获得经验,也可以从失败中吸取教训。

面向对象的开发过程中最重要的一本书是《设计模式:可复用面向对象软件的基础》,由Erich Gamma、Richard Helm、Ralph Johnson和John Vlissides编写。该书是软件领域中重要的里程碑,而且在计算机科学词库中占据重要地位。该书的作者被称为四人帮(Gang ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Node与Express开发(第2版)

Node与Express开发(第2版)

Ethan Brown
手把手教会你linux

手把手教会你linux

桑德.范.乌格特
Java并发编程实战

Java并发编程实战

Brian Goetz, Tim Peierls

Publisher Resources

ISBN: 9787111684527