One module per class, bad idea?

Carl Banks pavlovevidence at gmail.com
Mon Dec 25 13:40:46 EST 2006


Kent Johnson wrote:
> Carl Banks wrote:
> > Kent Johnson wrote:
> >> Carl Banks wrote:
> >>> Now, I think this is the best way to use modules, but you don't need to
> >>> use modules to do get higher-level organization; you could use packages
> >>> instead.  It's a pain if you're working on two different classes in the
> >>> same system you have to keep switching files; but I guess some people
> >>> prefer to switch files rather than to scroll for some reason.
> >> That would be me. I strongly prefer to switch files rather than scroll.
> >> I use an editor that makes it easy to switch files. For me it is much
> >> easier to switch between files than to scroll between two parts of a
> >> file, and I don't lose my place when I switch back. I like to be able to
> >> see things side by side.
> >
> > Man, I don't know you do it.
> >
> > Say I'm sitting there concentrating on programming something, and I see
> > that I'll have to make a change in another file.  All of a sudden, I
> > have to recall some filename out of thin air.  Totally breaks my train
> > of thought, sometimes I space out trying to think of it because I have
> > to cold-start an entirely different part of my brain.  It's less of a
> > mental distraction to just scroll.
>
> But then to go back to where you were, you have to scroll back and find
> your place.

See, I find that to be a lot less of a mental disruption than recalling
a filename on the spot.

> For me, just a click or keystroke to restore the last file
> with the cursor or selection exactly where I left it. And if I am going
> back and forth between the two, each switch is equally easy after the
> first (opening the file).

Ok, but doesn't your editor have bookmarks?  (I don't use them, because
remembering a bookmark name is the same mental disruption for me as
remembering a filename.  Sometimes I use an interactive search will get
me to where I want to go if it's more than a screen or two.)

> > (BTW, any decent editor will let you view different positions of the
> > same file side-by-side.)
>
> Right, at a cost of showing you half as much of the one you care about.

I presume if you're looking at two different files side-by-side it's at
the same cost?

> Anyway, I'm not trying to convince anyone to change, just pointing out
> that there are different styles of editing that make sense to those who
> use them, if not to outside observers ;-)

That's fine; I'm not knocking anyone's style.  But maybe you should
just leave it at, "I just prefer small files", and cease with the
editor-based arguments.

To be sure, there are probably editors out there that can load several
files into the same buffer, which would mean I could avoid recalling
filenames even when editing multiple files.  (In fact, I think I'll
look for such a solution the next time I find myself editing Java.)
It's really not about the editor; I just think that the module is the
best place for higher-level organization.

But the package will do.


Carl Banks




More information about the Python-list mailing list