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

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)