One class per file

Hi

Do you not think that one class per file has lot of advantage is
distribution of classes to be used by other programmers.

rolo

rolo wrote:

Do you not think that one class per file has lot of advantage is
distribution of classes to be used by other programmers.

Matter of opinion. Personally I see no reason for a class-file
correspondence unless someone is in love with Java.

Hal

Hi,

Hi

Do you not think that one class per file has lot of
advantage is
distribution of classes to be used by other
programmers.

rolo

The Delphi libraries use lots of classes per file. I
don’t remember if the Java libraries use lots of
classes per file, but one of the reasons Java promotes
one class per file is because of its scope (public).
As Ruby saves typing (lines of code), one class per
file is too little IMHO (maybe even in Java it’s too
little).

Just wondering out loud :slight_smile:

Cheers,
Joao

···

— rolo rohitlodha@hotwireindia.com wrote:


Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover

Hi.

rolo wrote:

Do you not think that one class per file has lot of advantage is
distribution of classes to be used by other programmers.

It depends how you organise your code, I’d guess.
If you develop several classes that somehow belong together (all are
data analisys related, web-oriented or whatever the ‘theme’ is), I’d
probably tend to put them into one file - or into one module in one
file. Which kind of leads back to the one class per file…

Stephan

For me, it has little to do with classes. I just group related code,
and split it up when/if the file gets too big. I rarely put two things
in one file though, if they are not closely related; ie, subclasses,
dependencies, etc.

cheers,
–Mark

···

On May 4, 2004, at 8:15 AM, rolo wrote:

Hi

Do you not think that one class per file has lot of advantage is
distribution of classes to be used by other programmers.

rolo wrote:

Do you not think that one class per file has lot of advantage is
distribution of classes to be used by other programmers.

Of course! It’s faster to recompile… oh, nevermind.

Ed

Hi

Do you not think that one class per file has lot of advantage is
distribution of classes to be used by other programmers.
IMHO, i think that file-oriented development gives you a freedom
of choosing your program structure. You can choose whatever the
style you want, of course you can choose class per file structure.
But for me, classes related to each over should be in their own file,
that’s my rule.

···

On Tuesday 04 May 2004 23:15, rolo wrote:

rolo


sdmitry -=- Dmitry V. Sabanin
MuraveyLabs.
Spam Here → postmaster@sco.com

“Hal Fulton” hal9000@hypermetrics.com schrieb im Newsbeitrag
news:4097B625.8070703@hypermetrics.com

rolo wrote:

Do you not think that one class per file has lot of advantage is
distribution of classes to be used by other programmers.

Matter of opinion. Personally I see no reason for a class-file
correspondence unless someone is in love with Java.

Even in that case there’s no need for 1 class per file… :wink:

robert

We base this decision on reuse. Classes are essentially libraries
(or software IP if you will) that can be reused. The ‘how many
classes to put in a file’ question is answsered by the ‘what block
of functionality can be reused independently by the others’ question.

···

On Wednesday, 5 May 2004 at 2:02:54 +0900, Mark Hubbart wrote:

On May 4, 2004, at 8:15 AM, rolo wrote:

Hi

Do you not think that one class per file has lot of advantage is
distribution of classes to be used by other programmers.


Jim Freeze
We will have solar energy as soon as the utility companies solve one
technical problem – how to run a sunbeam through a meter.

My favourite answer.

I find myself making new files whenever I notice pieces of code I’d
like to use in different applications.

But what’s the best way to organize those files? Groups of files
naturally belong to directories. Using a single folder per application
works fine if I don’t reuse files. One day I will come to the point
where I have to maintain reusable files in different directories. The
next step will be that wo different applications need different
versions of the files and as far as I can see neither cvs nor
subversion help me with this kind of problem.

I am sure that the Ruby community will find appropriate anwers to
different kind of code reuse problems. As I am coding VisualWorks
Smalltalk most of the time, I like the idea of managing code rather
than files. The current Ruby way has the advantage that there is no
special build procedure and you can distribute applications by just
distributing their sources.

Cheers
Sascha

···

Jim Freeze jim@freeze.org wrote:

We base this decision on reuse.

One class per file can help to have on demand loading. requires loads all
the classes in that file.

makes sense?

rolo