Personal tools
Document Actions

import this.NET

by Dan Fairs posted on 2008-04-15 16:28 last modified 2008-04-15 16:29 —
The Zen of Python doesn't just apply to Python.

PEP 20 is one of the most important documents that you read as a Python programmer. For the lazy, here's the meat:

Beautiful is better than ugly. 
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way
to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

The interesting thing about this PEP, of course, is that it doesn't really apply to Python. It applies to the programmer. Therefore, it applies equally well to most software development; be it in Python, C#, SQL, or whatever. Whenever I find myself faced by a design decision where I'm unsure of the best path, applying the guidelines above usually helps me decide.

Try it yourself. You'll be surprised how the above cuts through a lot of design cruft.

(Having said that, I'm not sure the one about being Dutch really applies to .NET.)


 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: