Why NOT only one class per file?

H

Hendrik van Rooyen

Bart Willems said:
I guess you're one of those sissies who uses EDLIN as an editor.

REAL programmers use COPY CON: ... :)

Naaah.. Real programmers fill in their coding sheets using
indelible ink in their fountain pens, and then send them off
to be punched and verified.

None of this weak minded backspace stuff for us...

- Hendrik
 
D

Dennis Lee Bieber

Naaah.. Real programmers fill in their coding sheets using
indelible ink in their fountain pens, and then send them off
to be punched and verified.
Where are they finding that ink!?

Pretty much all of the fountain pen ink manufacturers have descended
to water-based dyes... (Except for a few bottles from Noodlers, which
are rated as permanent).

The common iron-gall inks of mid-century have faded away as being
too acidic (sure, they were permanent -- they etched their way into the
paper over time <G>)
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
C

Chris Lasher

A friend of mine with a programming background in Java and Perl places
each class in its own separate file in . I informed him that keeping
all related classes together in a single file is more in the Python
idiom than one file per class. He asked why, and frankly, his valid
question has me flummoxed.

[snip]

Thoughts, comments, and insight much appreciated,
Chris

Thanks to all who replied and made this a very interesting and
informative discussion! It gave my friend, and myself, plenty to think
about.

Much appreciated,
Chris
 
B

Bruno Desthuilliers

Sherm Pendley a écrit :
Obviously, you have no sense of humor.

Obviously, we don't have the same sense of humor.
You've already decided that "monster classes" are bad design,

I came to this conclusion from my own experience, and it seems that
quite a few other programmers (most of them either better and/or more
experimented than me) came to the same conclusion. But feel free to
believe it's an a priori if that makes you feel better.
and that
anything conflicting with your belief is mere pretense. Why should I waste
my time debating when you've already made up your mind?

Then don't. But I'd still be interested if you could let us know about
any book advocating monster classes as good design.
I didn't say otherwise.

So let's rephrase your previous assertion :
"what works well for almost anyone having some real world experience
with languages like Python isn't necessarily what works well for
everyone" (implied : "... when using a Python-like language" - this
seemed obvious but it may be better to state it more explicitly, just in
case...).
You're arguing a false dichotomy;

Nope, just stating a fact - from which you may or not derive some
conclusions.
the fact that one
approach works well does not prove that others won't work equally well.

The fact that a in a given context a significant majority of
experimented users usually favors one approach over the other might be
taken as an indication that there might be some reason for this.

About "proofs", I'm afraid that "proving" things learned from experience
can be sometimes difficult - or at least above my own skills, specially
in a language I'm not very fluent with. But I think I did tried (perhaps
unsuccessfully, but that's another problem) to back my POV, instead of
just resorting to rethoric like you're doing here.
I'm
not saying that your preferred style is wrong; I'm just saying that it's a
matter of preference, not a universal truth.

If it was only *my* "preferred style", I wouldn't even argue. Now I'm
not presenting it as a "universal truth", but as the result of
experience (and not only my own) with a given class of languages.

Asserting that one should *always* only put one class per file is just
as non-sensical as asserting that one should *always* put several
classes in a same file. Not only because Python doesn't requires you to
use classes, but mostly because it's arbitrary and dogmatic. You seem to
have (dis)missed the point where I said that I *almost* never had a
single class in a file - which implies that I *sometimes* do this - when
it makes sens from either a practical or logical POV.

FWIW, I would certainly not try to apply this "preferred style" when
writing GUIs in C++. You see, the fact that some idiom (style, whatever)
works well with a given (class of) language(s) doesn't mean it's the
more effective in some other context. Here again, it seems that you
(dis)missed the point where I asked you if your thousands-lines-long
classes were written in Python.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top