One module per class, bad idea?

Carl Banks pavlovevidence at gmail.com
Fri Dec 22 20:51:55 EST 2006


Paddy wrote:
> Carl Banks wrote:
> > Erik Johnson wrote:
> > >     The file has now grown into a 6800 line beast (including docstring,
> > > whitespace, and CVS history).   Pretty much any time we implement some new
> > > functionality, there are at least a few changes in that file. When you have
> > > multiple developers working on different projects, and they all need to be
> > > making changes to that file, the chances for someone making a merge error
> > > goes up.  So, we are obviously at a point where that file needs to be split
> > > up, but there are lots of other files that import and use the one file, so
> > > it is a task that has been put off.  In retrospect, I wish I has started
> > > things under a one class per file strategy, but at the time, it didn't make
> > > a lot of sense to split those things up and I didn't anticipate the code
> > > getting that big.
> >
> > Refactor NOW.
>
> Are there tools out their to help with the refactoring task of
> splitting a module into two or more sections then showing what other
> files need to change?

I don't know what spiffy tools there are.  If all I'm doing is moving a
class from one module to another, then a simple interactive search and
replace suffices for me; I modify import lines by hand.


Carl Banks




More information about the Python-list mailing list