****SPAM(11.2)**** [Tutor] Larger program organization

Bob Gailer bgailer at alum.rpi.edu
Fri Feb 11 21:34:14 CET 2005


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.

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/>http://www.acceleration.net/
>
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor

Bob Gailer
mailto:bgailer at alum.rpi.edu
303 442 2625 home
720 938 2625 cell 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050211/cea801ea/attachment.html


More information about the Tutor mailing list