By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,683 Members | 1,597 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,683 IT Pros & Developers. It's quick & easy.

Good Practice question

P: n/a
Hi,

I m working on new asp.net project.
I will use n-layer architecture.
So my question is about the business object.

I have some little classes like category, collections, etc...
each of them has 2 or 3 properties.
So is it better to use only one class file that will include all these
little classes or use one class file for each class ?

Thanks for sharing your experience.
Stan

Jun 11 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Generally speaking, code is more maintainable and easier for others to work
with when each class has its own file.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Stan SR" wrote:
Hi,

I m working on new asp.net project.
I will use n-layer architecture.
So my question is about the business object.

I have some little classes like category, collections, etc...
each of them has 2 or 3 properties.
So is it better to use only one class file that will include all these
little classes or use one class file for each class ?

Thanks for sharing your experience.
Stan

Jun 11 '07 #2

P: n/a
Ysgrifennodd Peter Bromberg [C# MVP]:
Generally speaking, code is more maintainable and easier for others to work
with when each class has its own file.
Peter
I agree
Peter
Jun 11 '07 #3

P: n/a
On Jun 11, 1:04 pm, Peter Bradley <p.brad...@dsl.pipex.comwrote:
Ysgrifennodd Peter Bromberg [C# MVP]:Generally speaking, code is more maintainable and easier for others to work
with when each class has its own file.
Peter

I agree

Peter
Version control is also a consideration. It is much more efficient
to have each object separate in the event of rolling back to specific
versions of maintainable classes and not having changes to one class
tied to another.

Joseph

Jun 11 '07 #4

P: n/a

I concur.

Seperate them out into classes.

Also see:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!140.entry

I prefer (for collection of my custom objects (in 2.0)) the following

public class EmployeeCollection : List <Employee>
{}


"Stan SR" <st**@pasdepam.netsunset.comwrote in message
news:Og*************@TK2MSFTNGP06.phx.gbl...
Hi,

I m working on new asp.net project.
I will use n-layer architecture.
So my question is about the business object.

I have some little classes like category, collections, etc...
each of them has 2 or 3 properties.
So is it better to use only one class file that will include all these
little classes or use one class file for each class ?

Thanks for sharing your experience.
Stan

Jun 11 '07 #5

P: n/a
I agree that "generally" it's better to have them in separate files.
However, for the sake of convenience I might make an exception in a case
where I'm fairly certain these classes are unlikely to grow.

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net


"Stan SR" <st**@pasdepam.netsunset.comwrote in message
news:Og*************@TK2MSFTNGP06.phx.gbl...
Hi,

I m working on new asp.net project.
I will use n-layer architecture.
So my question is about the business object.

I have some little classes like category, collections, etc...
each of them has 2 or 3 properties.
So is it better to use only one class file that will include all these
little classes or use one class file for each class ?

Thanks for sharing your experience.
Stan
Jun 12 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.