Bob Gailer said unto the world upon 2005-02-11 15:34:
At 10:39 AM 2/11/2005, Ryan Davis wrote:

I'm starting to make a code-generation suite in python, customized to the way we ASP.NET at my company, and I'm having some trouble finding a good way to organize all the code.


My take on doing that in Python:

Organize things into modules. Especially with an eye to potential reuse. Look at the module index in the docs to see how most of the "standard" modules focus on doing one thing well.

Within a module create classes for every conceivable object. Whenever you find yourself writing an if statement ask whether this would be better handled by subclasses. Whenever you find yourself about to write a global statement, consider making the variables properties of a class.

<SNIP>

Hi all,

as readers of another concurrent thread will know, I am, with lots of help, just beginning to start thinking about proper OOP design.

I am curious about Bob's "Whenever you find yourself writing an if statement ask whether this would be better handled by subclasses."

Could you explain a bit more?

Thanks and best,

Brian vdB

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to