Thread: [SQLObject] Application Design Question
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Glenn R. <gru...@ed...> - 2011-12-10 23:10:14
|
I need help managing my project files. I've got over 120 class files each that have their own specific validation routines. Most of which are pretty tame, but some are pretty nasty. Anyways, I took a stab at a creating one .py file for each class, but it's turning out to be a mess of include statements. Going back to a single file makes for a HUGE file which is manageable, but annoying when searching for particular code. Anyways - I though I'd ask to see if there were any examples or resources out there that I could look at that would help me clean this up. Thanks, Glenn |
From: Oleg B. <ph...@ph...> - 2011-12-11 00:57:25
|
Hi! On Sat, Dec 10, 2011 at 02:47:44PM -0800, Glenn Rutkowski wrote: > creating one .py file for each class, but it's turning out to be a mess > of include statements. He-he, Python is not Java! > Going back to a single file makes for a HUGE > file which is manageable, but annoying when searching for particular code. You are choosing between two extreme solutions ("one class - one file" and "all classes in one file") which IMHO are too extreme. Let me advice to use something in between - use a few files. Put in one bed things that naturally go together well, put in different files classes that have no connection. Another advice would be to use pytags and a good IDE or at least an editor that supports tags - that way you wouldn't spend much time searching for names. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Daniel F. <fet...@go...> - 2011-12-11 16:22:27
|
> I need help managing my project files. I've got over 120 class files > each that have their own specific validation routines. Most of which > are pretty tame, but some are pretty nasty. Anyways, I took a stab at a > creating one .py file for each class, but it's turning out to be a mess > of include statements. Going back to a single file makes for a HUGE > file which is manageable, but annoying when searching for particular code. > > Anyways - I though I'd ask to see if there were any examples or > resources out there that I could look at that would help me clean this up. Why not put around 10-20 classes that are closely related into one file? This is what I do too, then you have around 10-15 files which is manageable all right. Surely your classes can be grouped according to some criteria. Search and jumping around in source code is quite easy in vim which is what I use, but I bet other good editors make it simple too. So normally you don't have to search for strings but the function names, class names, etc, are stored structurally in a 'tags' file which is then used by the editor. Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown |
From: Petr J. <pet...@tp...> - 2011-12-11 18:43:50
|
On 11 December 2011 17:22, Daniel Fetchinson <fet...@go...>wrote: > > I need help managing my project files. I've got over 120 class files > > each that have their own specific validation routines. Most of which > > are pretty tame, but some are pretty nasty. Anyways, I took a stab at a > > creating one .py file for each class, but it's turning out to be a mess > > of include statements. Going back to a single file makes for a HUGE > > file which is manageable, but annoying when searching for particular > code. > > > > Anyways - I though I'd ask to see if there were any examples or > > resources out there that I could look at that would help me clean this > up. > > As Oleg and Daniel suggest, using good IDE is the great advantage. Personally, I am using Eric4 <http://eric-ide.python-projects.org/> which is long time well supported and maintained. You can maintain/manage the whole project. You can see all files for the project. You can see all classes within each file. You can see all attributes and functions if any. You can make string search through the all files in the project .... and many many more. Of course there are plenty of other IDE for Python<http://wiki.python.org/moin/PythonEditors> . Cheers Petr |
From: Glenn R. <gru...@ed...> - 2011-12-11 19:05:35
|
Daniel & Oleg, > > creating one .py file for each class, but it's turning out to be a mess > > of include statements. > > He-he, Python is not Java! I was anticipating this response, but I did have good intentions when we set out. We are working on an application that will validate and export data from an archaic accounting system with 16 years of patchwork and zero documentation. Because we have no idea how things relate to each other, we just created a class for every table in the system and proceeded to work with them. Overall, it was a good refresher in Bad Python Coding Principles 101. In regards to the editor, seeing as how I'm on a windows machine, I've chosen to install Eclipse and PyDev to help manage this project as UltraEdit just didn't have the oomph to handle the sheer size of it all. |