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?
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.
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With