Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

Good Practice question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stan SR - 11 Jun 2007 17:11 GMT
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
Peter Bromberg [C# MVP] - 11 Jun 2007 17:58 GMT
Generally speaking, code is more maintainable and easier for others to work
with when each class has its own file.
Peter

Signature

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

> Hi,
>
[quoted text clipped - 9 lines]
> Thanks for sharing your experience.
> Stan
Peter Bradley - 11 Jun 2007 18:04 GMT
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
Joseph Ferris - 11 Jun 2007 18:27 GMT
> 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.
[quoted text clipped - 3 lines]
>
> 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
sloan - 11 Jun 2007 19:07 GMT
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>
{}

> Hi,
>
[quoted text clipped - 9 lines]
> Thanks for sharing your experience.
> Stan
Steve C. Orr [MCSD, MVP, CSM, ASP Insider] - 12 Jun 2007 06:53 GMT
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.

Signature

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

> Hi,
>
[quoted text clipped - 9 lines]
> Thanks for sharing your experience.
> Stan

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.