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

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

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

8.4.1 一个电子商务问题

也许领略重用的力量最好的方式就是通过一个例子来练习如何重用代码。本例中,我们将使用(通过接口和抽象类)继承和组合。我们的目标是创建一个框架,它会真正实现代码重用,减少编码时间以及维护时间——这是典型的软件开发的普遍期望。

让我们开始构建自己的互联网商业。假设我们拥有一个客户,名为Papa’s Pizza的小比萨店。尽管它非常小,属于家庭生意,但Papa认为互联网会带来更多的生意。Papa想让他的客户访问他的网站,全面了解Papa’s Pizza,而且可以通过自己的浏览器来预定比萨。

在我们开发的网站上,客户可以访问该网站,选择他们想要的商品,并且选择快递的方式和时间。他们可以在餐馆吃东西,预定食物,并且快递过来。例如,客户在3点钟决定预定一个比萨作为晚饭(还有沙拉、面包和饮料),并且在6点钟送到他家。假设客户在工作中(当然这时在休息),他访问网站并选择比萨,包括尺寸、配料和外包装、包含调料的沙拉、面包棒和饮料。然后选择运送选项,要求食物在6点钟送到他家。然后他用信用卡付账,得到了确认号码,并且退出。几分钟后,他收到了一份确认邮件。我们可以设置账号,所以当打开网站可以记住是哪个用户登录了,该用户最喜欢什么比萨,本周制造了什么新的比萨等。

当该软件系统成功交付后,它取得了巨大的成功。接下来的几周,Papa的客户很乐意通过网络预订比萨和其他的食物和饮料。在推广期,Papa的表兄弟访问了Papa,这个表兄弟拥有一个名为Dad’s Donts的甜甜圈商店。Papa给Dad展示了这个系统,Dad非常喜欢该系统。第二天,Dad给我们公司打电话想让我们为他的甜甜圈商店开发一个基于Web的系统。这非常棒,正是我们希望的。现在我们如何在甜甜圈店系统中重用为比萨店写的代码呢? ...

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

桑德.范.乌格特
Go程序设计语言

Go程序设计语言

艾伦A. A.多诺万, 布莱恩W. 柯尼汉

Publisher Resources

ISBN: 9787111684527