In this video, we will analyze the issues in the code of the Todo list app. 1 在这段视频中，我们将分析待办事项列表应用程序代码中的问题。1
This will help us understand why we need object-oriented programming. 2 这将帮助我们理解为什么需要面向对象编程。2.
We will learn what procedural programming is and what problems it can cause. 3 我们将学习什么是过程性编程以及它会导致什么问题。3.
Additionally, we will understand what an anti-pattern is and, specifically what spaghetti code anti-pattern 4 此外，我们还将了解什么是反模式，特别是什么是意大利代码反模式4
is about. 5 是关于。5.
Finally, we will learn what high quality code must always be ready for. 6 最后，我们将学习高质量代码必须始终做好准备的内容。6.
Before we understand what object-oriented programming is, let's take a look at the code of the Todo 7 在我们理解什么是面向对象编程之前，让我们先来看一下TODO 7的代码
list app we created in the first section. 8 列出我们在第一部分中创建的应用程序。8个
We will try to see what is the structure of this program. 9 我们将试着看看这个节目的结构是什么。9.
The design here is simple. 10 这里的设计很简单。10
The code is executed from top to bottom. 11 代码从上到下执行。11.
The program stops once we reach this line. 12 一旦我们到达这条线，程序就会停止。12
Everything below is the methods we created to improve the readability and reusability of the code. 13 下面的所有内容都是我们为提高代码的可读性和重用性而创建的方法。13个
This doesn't look so bad for now, but this is a very simple application. 14 现在看起来还不错，但这是一个非常简单的应用程序。14.
If it grows, this file will grow as well and it will become harder and harder to read. 15 如果它增长，该文件也将增长，并且它将变得越来越难读。15个
If you wonder how big real world applications can be, let me tell you that the largest project I worked 16 如果你想知道现实世界的应用程序能有多大，让我告诉你，我参与的最大的项目16
on had over 2 million lines of code in total. 17 On总共有200多万行代码。17
We could perhaps split this file somehow and place some of those methods in their own *.cs files, but 18 我们或许可以以某种方式拆分这个文件，并将其中一些方法放在它们自己的*.cs文件中，但是18
this would raise other problems. 19 这还会引发其他问题。19个
For example, what if we wanted to limit who can call those functions? 20 例如，如果我们想要限制谁可以调用这些函数呢？
Sometimes it is necessary if, for instance, the function modifies some critical data. 21 例如，如果函数修改了一些关键数据，则有时它是必要的。21岁
Also, even with functions moved to their dedicated files, the main logic of the program, which utilizes 22 此外，即使将函数移到它们的专用文件中，程序的主要逻辑也利用了22
them, may still be very long and complex. 23 他们，可能仍然是非常长和复杂的。23个
Another issue here is that there is no separation by the levels of abstraction. 24 这里的另一个问题是不存在按抽象级别划分的问题。24个
It is a good practice to separate high-level business decisions from low-level technical details. 25 将高级别业务决策与低级别技术细节分开是一种良好的实践。25个
For example, a high-level business decision says that the user can see, add or delete todos. Low-level 26 例如，高级业务决策表示用户可以查看、添加或删除待办事项。低层26
detail is that they can communicate with the program via the console. 27 细节是，他们可以通过控制台与程序进行通信。27
The thing about low-level details is that they often change. 28 关于低级别细节的问题是，它们经常发生变化。28
The feature of adding TODOs is unlikely to be removed, but communication via console can be switched 29 添加待办事项的特征不太可能被移除，但是可以切换通过控制台的通信29
to something else. 30 去做其他的事。30个
If we as developers are one day asked to modify this application to have some graphical user interface 31 如果有一天我们作为开发人员被要求修改该应用程序以具有某些图形用户界面31
we'll have no easy way of achieving this with the current design. 32 用目前的设计，我们不会有简单的方法来实现这一点。32位
Sometimes we are not simply asked to change the behavior of the code. 33 有时，并不是简单地要求我们更改代码的行为。33
Instead, we are asked to give the ability to have two or more different behaviors depending on some 34 取而代之的是，我们被要求给予拥有两种或更多不同行为的能力，这取决于大约34种行为
configuration. 35 配置。35岁
Imagine that the todo list app user could decide to store the todos directly on their device or in 36 想象一下，待办事项列表应用程序用户可以决定将待办事项直接存储在他们的设备上，还是在36个月中存储
the cloud, depending on some settings. 37 云，取决于某些设置。37
Currently, this would be complicated and would involve filling our code with multiple if statements. 38 目前，这将是复杂的，需要用多个if语句填充我们的代码。38
This code would not be easy to maintain, meaning any future code changes would be painful to implement. 39 这段代码不容易维护，这意味着将来的任何代码更改都很难实现。39
It is crucial that we create our code in such a way that it is easy to be modified in the future because 40 至关重要的是，我们以这样一种方式创建代码，以便将来易于修改，因为40
the requirements change very often. 41 需求经常发生变化。41
The paradigm this code is in line with is called procedural programming. 42 这段代码所遵循的范例称为过程性编程。42
The program is composed of procedures called methods, in our case, each containing a series of steps. 43 该程序由称为方法的过程组成，在我们的例子中，每个过程都包含一系列步骤。43
Those procedures are called from some main flow of the program or from one another. 44 这些过程是从程序的某个主流调用的，或者是从彼此调用的。44
We already mentioned some of the problems this paradigm can cause. 45 我们已经提到了这种范式可能导致的一些问题。45
In general, it leads to creating something we call spaghetti code: a messy, tangled code as hard to 46 一般来说，这会导致创建我们称为意大利面条代码的东西：一个杂乱、纠结的代码，就像46
follow as following a single thread in a bowl of spaghetti. 47 接下来是一碗意大利面中的一根线。47
It is hard to move or remove a single thread from such a bowl without moving anything else. 48 在不移动其他任何东西的情况下，很难从这样的碗中移动或移除一根线。48
Similarly, it is hard to change anything in the spaghetti code. And this is something I want to emphasize 49 同样，在意大利面条代码中也很难更改任何内容。这是我想强调的一点
again: 50 再说一次：50
we must always be ready for the requirements to change and to adjust our code to them. 51 我们必须始终为需求的变化做好准备，并根据需求调整代码。51
Change is the only constant in programming. 52 变化是编程中唯一不变的东西。52
There are very few projects where the complete requirements are known in detail before developers start 53 很少有项目在开发人员开始之前详细了解完整的需求53
the work, and never change during the development process. 54 工作，并且在开发过程中永远不会改变。54
Think of applications like Facebook, YouTube or Steam. 55 想想Facebook、YouTube或STeam等应用程序吧。55
You probably see some changes in them every few weeks. 56 你可能每隔几周就会看到一些变化。56
By the way, spaghetti code is an example of an antipattern, so something we should avoid if our code 57 顺便说一句，意大利面条代码是反模式的一个例子，所以如果我们的代码57
is supposed to be of high quality. 58 应该是高质量的。58
We'll learn more about antipatterns and avoiding them later in the course. 59 我们将在本课程后面的部分学习更多关于反模式和避免反模式的知识。59
We mentioned some of the issues caused by procedural programming. 60 我们提到了由过程性编程引起的一些问题。60
They have been the pain in developers necks for a long time. 61 很长一段时间以来，它们一直是开发人员的痛处。61
As a solution, a new paradigm called object-oriented programming was invented in the 60s and became 62 作为一种解决方案，一种名为面向对象编程的新范例在60年代发明，并于1962年问世
popular in the 90s. 63 在90年代很受欢迎。63
Today it is the most followed paradigm and most mainstream programming languages support it. 今天，它是最受欢迎的范例，大多数主流编程语言都支持它。