PC Review


Reply
Thread Tools Rate Thread

Class - one at a time or many

 
 
John
Guest
Posts: n/a
 
      8th Sep 2003
Hi

I have several classes. Should I keep them as separate class files or can I
keep them all in a single file?

Thanks

Regards


 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      8th Sep 2003
Hello,

"John" <(E-Mail Removed)> schrieb:
> I have several classes. Should I keep them as separate class
> files or can I keep them all in a single file?


Every class should be kept in a separate file (except nested classes).

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
BigMomma
Guest
Posts: n/a
 
      8th Sep 2003
Whatfor can you put many classes in one file at a time? I thought it was
just help for the programmer, so that he can organize his classes better.
But as it sounds there is another reason for that. What is the reason?
I usually create a new file for each class.

Thanx for help,

BigMomma


 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      8th Sep 2003
"John" <(E-Mail Removed)> schrieb
> I have several classes. Should I keep them as separate class files or
> can I keep them all in a single file?


I prefer separate files, but it's also possible to keep some in the same
file.


--
Armin

 
Reply With Quote
 
Stephany Young
Guest
Posts: n/a
 
      8th Sep 2003
As others have said, it really boils down to a matter of choice, however it
could be helpful to group classes together by topic. e.g.:
Classes relating to forms in one file
Classes releating to ADO.Net in another file
etc.

"BigMomma" <(E-Mail Removed)> wrote in message
news:bjivll$215$01$(E-Mail Removed)...
> Whatfor can you put many classes in one file at a time? I thought it was
> just help for the programmer, so that he can organize his classes better.
> But as it sounds there is another reason for that. What is the reason?
> I usually create a new file for each class.
>
> Thanx for help,
>
> BigMomma
>
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      9th Sep 2003
Hello,

"Stephany Young" <(E-Mail Removed)> schrieb:
> As others have said, it really boils down to a matter of choice,
> however it could be helpful to group classes together by
> topic. e.g.:
> Classes relating to forms in one file
> Classes releating to ADO.Net in another file


In VS.NET, you can group the classes in folders. There is IMHO no need
to put more than one class (except nested classes) into a single file.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      9th Sep 2003
Hello,

"BigMomma" <(E-Mail Removed)> schrieb:
> I usually create a new file for each class.


\\\
Public Class Foo
Public Class Bar
 
Reply With Quote
 
Stephany Young
Guest
Posts: n/a
 
      9th Sep 2003
Yes, however the point is that if one want's to then one can - It is a
matter of choice.

"Herfried K. Wagner [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> "Stephany Young" <(E-Mail Removed)> schrieb:
> > As others have said, it really boils down to a matter of choice,
> > however it could be helpful to group classes together by
> > topic. e.g.:
> > Classes relating to forms in one file
> > Classes releating to ADO.Net in another file

>
> In VS.NET, you can group the classes in folders. There is IMHO no need
> to put more than one class (except nested classes) into a single file.
>
> --
> Herfried K. Wagner
> MVP · VB Classic, VB.NET
> http://www.mvps.org/dotnet
>
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      9th Sep 2003
Hello,

"Stephany Young" <(E-Mail Removed)> schrieb:
> Yes, however the point is that if one want's to then one
> can - It is a matter of choice.


You are right. Nevertheless, there are a lot of VB.NET programmers who
do not know that classes can be grouped in folders.

;-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      9th Sep 2003
Stephany,
> Yes, however the point is that if one want's to then one can - It is a
> matter of choice.

Yes you have the choice of putting two forms in one file.

However! be warned if you make this choice, then you will no longer be able
to design the forms in VS.NET!

I do agree with you, one of the nice benefits of VB.NET over VB6 is that I
can put any number of types in a single source file! By type I mean Class,
Module, Structure, Delegate, or Enum. In fact I can put any number of
namespaces in a single source file. Lately I'm finding I limit one class,
module or structure to a source file, however I will group many Delegates &
Enums in a single source file. Either with the class or structure that they
are closely associated with or a common file, if they are related to a group
of classes, modules, or structures. Except for nested classes, which are
implementation details any way...

Hope this helps
Jay

"Stephany Young" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Yes, however the point is that if one want's to then one can - It is a
> matter of choice.
>
> "Herfried K. Wagner [MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hello,
> >
> > "Stephany Young" <(E-Mail Removed)> schrieb:
> > > As others have said, it really boils down to a matter of choice,
> > > however it could be helpful to group classes together by
> > > topic. e.g.:
> > > Classes relating to forms in one file
> > > Classes releating to ADO.Net in another file

> >
> > In VS.NET, you can group the classes in folders. There is IMHO no need
> > to put more than one class (except nested classes) into a single file.
> >
> > --
> > Herfried K. Wagner
> > MVP · VB Classic, VB.NET
> > http://www.mvps.org/dotnet
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What kind of search path is used in design time and run time when using class library. tony Microsoft C# .NET 0 3rd Apr 2006 08:25 AM
What kind of search path is used in design time and run time when using class library. tony Microsoft Dot NET 0 3rd Apr 2006 08:21 AM
DateTime Class shows wrong time when Time Zone is changed Dave Hall Microsoft Dot NET Compact Framework 6 14th Jul 2004 06:05 PM
CLass Time Chazz Microsoft Outlook 0 14th May 2004 09:19 PM
Class Time Microsoft Outlook 0 14th May 2004 06:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:20 AM.