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.
Within classes create methods applicable to those classes. Within subclasses create methods applicable to those subclasses.
I keep writing it, but it feels more and more spaghetti-ish every day.
I'm going to look at the other stuff in site-packages to see if I can glean any wisdom, and have googled a bit, coming up mostly blank or with trivial examples. Are there any helpful links or advice anyone has for building larger systems?
My background is mostly C#, so I'm used to the ridiculous rigidity of strongly-typed languages. I have been using python for helper apps for a few months now, so am pretty familiar with the syntax now, but I don't know any of the patterns yet. My nefarious goal is to supplant C#/ASP.NET with Python, but I need to figure out how to make programs clients want to pay for before I can make any reasonable argument.
Thanks,
Ryan
----
Ryan Davis
Director of Programming Services
http://www.acceleration.net/
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor
mailto:[EMAIL PROTECTED]
303 442 2625 home
720 938 2625 cell
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
