Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[译] [700] 第七章 分解问题 #13

Open
cssmagic opened this issue Feb 29, 2024 · 0 comments
Open

[译] [700] 第七章 分解问题 #13

cssmagic opened this issue Feb 29, 2024 · 0 comments

Comments

@cssmagic
Copy link
Owner

cssmagic commented Feb 29, 2024

7 Problem Decomposition

第七章 分解问题

This chapter covers

本章内容概要

  • Understanding problem decomposition and why we need to do it
  • Using top-down design to carry out problem decomposition and write programs
  • Writing an authorship identification program using top-down design
  • 理解问题的分解及其重要性
  • 运用自顶向下的设计方法来分解问题并编写程序
  • 使用自顶向下的设计编写一个作者识别程序

In Chapter 3, we talked about why we shouldn’t ask Copilot to solve big problems. Imagine what could happen if we asked Copilot, “Write a program to determine the author of a book.”

在第三章,我们探讨了为什么不应该要求 Copilot 去解决大型问题。试想一下,如果我们对 Copilot 说 “编写一个判定书籍作者的程序”,会发生什么情况?

In the best case, we’d get a canned program with all of the decisions made for us. That program may not match what we wanted. Part of the power of being a programmer is customizing what we’re creating. To do this, we need to feed small sub-problems to Copilot and assemble those solutions into a program of our own. Even if we didn’t want to customize anything, what would we do if the program from Copilot had flaws? It would be difficult for us to fix a large program that we don’t understand.

在最理想的情况下,我们将获得一个全套的程序,其中所有决策都已经代我们做出。但这个程序可能并不完全满足我们的要求。程序员这个角色的魅力在于能够定制我们所创造的东西。为了实现这一点,我们需要向 Copilot 提出具体的子问题,并将这些解决方案组合成我们自己的程序。或许我们不想定制任何内容,但如果 Copilot 编写的程序存在瑕疵怎么办?修复一个我们不了解的大型程序会非常困难。

In the worst case, Copilot wouldn’t do anything useful. We observe this sometimes when Copilot gives us comments again and again but never provides us with real code.

在最糟糕的情况下,Copilot 给不出任何有用的东西。我们有时候会发现这种情况,比如 Copilot 只是反复输出注释,而不是提供实质性的代码。

In this chapter, we will learn how to break large problems into smaller ones. We can then use Copilot to solve each of the small sub-problems, thereby solving the large problem that we ultimately care about solving.

在本章中,我们将学习如何将大问题分解成小问题。然后我们可以使用 Copilot 来解决每个小的子问题,从而解决我们最终关心的大问题。


本章目录

  • 7.1 Problem decomposition
  • 7.2 Small examples of top-down design
  • 7.3 Authorship identification
  • 7.4 Authorship identification using top-down design
  • 7.5 Breaking down the process sub-problem
    • 7.5.1 Figuring out the signature for the mystery book
  • 7.6 Summary of our top-down design
  • 7.7 Implementing our functions
  • 7.8 Going further
  • 7.1 问题分解
  • 7.2 自顶向下设计的示例
  • 7.3 作者身份识别
  • 7.4 应用自顶向下设计识别作者身份
  • 7.5 分解子问题过程
    • 7.5.1 解析神秘书籍的签名
  • 7.6 自顶向下设计的总结
  • 7.7 实现具体函数
  • 7.8 更进一步

本章正文略。如需阅读,请购买正版。


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant