Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "Complex is better than complicated" mean? [closed]

Tags:

python

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?

like image 450
flycondor Avatar asked Dec 31 '10 07:12

flycondor


2 Answers

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.

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.

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:

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

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

like image 126
EinLama Avatar answered Sep 28 '22 04:09

EinLama


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.

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.

Some more articles on this:

  • Simple vs. Complicated vs. Complex vs. Chaotic
  • More on Complex versus Complicated
like image 35
moinudin Avatar answered Sep 28 '22 06:09

moinudin