“复杂比复杂更好”是什么意思?

时间:2023-01-15 12:55:19

In "The Zen of Python", by Tim Peters, the sentence "Complex is better than complicated" confused me. Can anyone give a more detailed explanation or an example?

在蒂姆·彼得斯的“禅宗之谜”中,“复杂比复杂更好”这句话使我感到困惑。任何人都可以提供更详细的解释或示例吗?

4 个解决方案

#1


38  

although complex and complicated sound alike, they do not mean the same in this context.

虽然复杂而复杂的声音相似,但在这种情况下它们并不一样。

The Zen therefore says: It is okay to build very complex applications, as long as the need for it is reasonable.

因此,Zen说:构建非常复杂的应用程序是可以的,只要对它的需求是合理的。

To give an example:

举个例子:

counter = 0
while counter < 5:
   print counter
   counter += 1

The code is very easy to understand. It is not complex. However, it is complicated. You do not need to manually perform most of the steps above.

代码很容易理解。这并不复杂。但是,它很复杂。您无需手动执行上述大多数步骤。

for i in xrange(5):
   print i

This code is more complex than the above example. But: knowing the documentation of ´xrange´ you can understand it by a single glance. Many steps are hidden behind an easy-to-use-interface.

此代码比上面的示例更复杂。但是:知道'xrange'的文档,你可以一眼就看出来。许多步骤隐藏在易于使用的界面背后。

As processes grow bigger, the gap between complicated and complex gets wider and wider.

随着流程变得越来越大,复杂和复杂之间的差距越来越大。

A general rule of thumb is to follow the other principles of the Zen of Python:

一般的经验法则是遵循Python的其他原则:

If it is hard to explain, it is not a good idea.

如果难以解释,那不是一个好主意。

If it's easy to explain, it might be a good idea.

如果它很容易解释,那可能是个好主意。

#2


10  

Complex: Does a lot. Usually unavoidable.

复杂:很多。通常是不可避免的。

Complicated: Difficult to understand.

复杂:难以理解。

I like this quote (source):

我喜欢这句话(来源):

A complex person is like an iPod. That is to say that they are consistent, straightforward and ‘user friendly’ while also being rather sophisticated. Unlike the complicated person, interacting with a complex person does not require special knowledge of their complicated ways-because their ways are not complicated. When mistakes are made, they tend to be very forgiving because they understand that people are imperfect. In short, they are mature, sensible human beings.

复杂的人就像一个iPod。也就是说,它们是一致的,直截了当的,“用户友好的”,同时也相当复杂。与复杂的人不同,与复杂的人交往不需要他们复杂方式的特殊知识 - 因为他们的方式并不复杂。当犯错时,他们往往非常宽容,因为他们明白人是不完美的。简而言之,他们是成熟,明智的人类。

and this one (source):

而这一个(来源):

An Airbus A380 is complicated. A jellyfish is complex. The Paris Metro network is complicated. How people use it is complex. Your skeleton is complicated. You are complex. A building is complicated. A city is complex.

空中客车A380很复杂。水母很复杂。巴黎地铁网络很复杂。人们如何使用它很复杂。你的骨架很复杂。你很复杂。建筑物很复杂。一个城市很复杂。

Some more articles on this:

关于此的更多文章:

#3


0  

i haven't read this book.

我还没读过这本书。

complex is in my opinion a solution that might be not easy to understand but is writen in simple and logic code.

在我看来,复杂的解决方案可能不容易理解,但是用简单的逻辑代码编写。

complicated is a solution that might be simple (or complex) but is written in code which is not easy to understand because there are no patterns or logic in it and no proper metaphors and naming.

复杂的是一个可能简单(或复杂)的解决方案,但是用不易理解的代码编写,因为其中没有模式或逻辑,也没有适当的隐喻和命名。

#4


0  

Complicated systems are highly coupled and therefore fragile.

复杂的系统高度耦合,因此很脆弱。

Complex systems are made of simple parts operating together to create complex emergent behavior. While the emergent behaviors may still be a challenge, the individual parts can be isolated, studied, and debugged. Individual parts can be removed and reused.

复杂系统由一起操作的简单部件组成,以创建复杂的紧急行为。虽然紧急行为可能仍然是一个挑战,但可以隔离,研究和调试各个部分。各个部件可以拆卸和重复使用。

I comment more on this topic and provide examples on my blog

我对此主题发表了更多评论,并在我的博客上提供了示例

#1


38  

although complex and complicated sound alike, they do not mean the same in this context.

虽然复杂而复杂的声音相似,但在这种情况下它们并不一样。

The Zen therefore says: It is okay to build very complex applications, as long as the need for it is reasonable.

因此,Zen说:构建非常复杂的应用程序是可以的,只要对它的需求是合理的。

To give an example:

举个例子:

counter = 0
while counter < 5:
   print counter
   counter += 1

The code is very easy to understand. It is not complex. However, it is complicated. You do not need to manually perform most of the steps above.

代码很容易理解。这并不复杂。但是,它很复杂。您无需手动执行上述大多数步骤。

for i in xrange(5):
   print i

This code is more complex than the above example. But: knowing the documentation of ´xrange´ you can understand it by a single glance. Many steps are hidden behind an easy-to-use-interface.

此代码比上面的示例更复杂。但是:知道'xrange'的文档,你可以一眼就看出来。许多步骤隐藏在易于使用的界面背后。

As processes grow bigger, the gap between complicated and complex gets wider and wider.

随着流程变得越来越大,复杂和复杂之间的差距越来越大。

A general rule of thumb is to follow the other principles of the Zen of Python:

一般的经验法则是遵循Python的其他原则:

If it is hard to explain, it is not a good idea.

如果难以解释,那不是一个好主意。

If it's easy to explain, it might be a good idea.

如果它很容易解释,那可能是个好主意。

#2


10  

Complex: Does a lot. Usually unavoidable.

复杂:很多。通常是不可避免的。

Complicated: Difficult to understand.

复杂:难以理解。

I like this quote (source):

我喜欢这句话(来源):

A complex person is like an iPod. That is to say that they are consistent, straightforward and ‘user friendly’ while also being rather sophisticated. Unlike the complicated person, interacting with a complex person does not require special knowledge of their complicated ways-because their ways are not complicated. When mistakes are made, they tend to be very forgiving because they understand that people are imperfect. In short, they are mature, sensible human beings.

复杂的人就像一个iPod。也就是说,它们是一致的,直截了当的,“用户友好的”,同时也相当复杂。与复杂的人不同,与复杂的人交往不需要他们复杂方式的特殊知识 - 因为他们的方式并不复杂。当犯错时,他们往往非常宽容,因为他们明白人是不完美的。简而言之,他们是成熟,明智的人类。

and this one (source):

而这一个(来源):

An Airbus A380 is complicated. A jellyfish is complex. The Paris Metro network is complicated. How people use it is complex. Your skeleton is complicated. You are complex. A building is complicated. A city is complex.

空中客车A380很复杂。水母很复杂。巴黎地铁网络很复杂。人们如何使用它很复杂。你的骨架很复杂。你很复杂。建筑物很复杂。一个城市很复杂。

Some more articles on this:

关于此的更多文章:

#3


0  

i haven't read this book.

我还没读过这本书。

complex is in my opinion a solution that might be not easy to understand but is writen in simple and logic code.

在我看来,复杂的解决方案可能不容易理解,但是用简单的逻辑代码编写。

complicated is a solution that might be simple (or complex) but is written in code which is not easy to understand because there are no patterns or logic in it and no proper metaphors and naming.

复杂的是一个可能简单(或复杂)的解决方案,但是用不易理解的代码编写,因为其中没有模式或逻辑,也没有适当的隐喻和命名。

#4


0  

Complicated systems are highly coupled and therefore fragile.

复杂的系统高度耦合,因此很脆弱。

Complex systems are made of simple parts operating together to create complex emergent behavior. While the emergent behaviors may still be a challenge, the individual parts can be isolated, studied, and debugged. Individual parts can be removed and reused.

复杂系统由一起操作的简单部件组成,以创建复杂的紧急行为。虽然紧急行为可能仍然是一个挑战,但可以隔离,研究和调试各个部分。各个部件可以拆卸和重复使用。

I comment more on this topic and provide examples on my blog

我对此主题发表了更多评论,并在我的博客上提供了示例