Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 11th, 2011, 05:45 PM
Authorized User
 
Join Date: Aug 2006
Posts: 41
Thanks: 1
Thanked 0 Times in 0 Posts
Default Best practice/naming convention asp.net app

Hi all,
I'll be starting a greenfield ASP.NET project in a few weeks (lucky me) and want to get the project off to a good start by putting some solid foundations / best practices down at a very early stage.

I'm doing some R&D around what's best practice around structuring the solution and naming conventions. Obviously it will depend on the domain, but I'm thinking 3 layer architecture and using namespaces instead of postfixing classes and project names with BLL/DAL, etc.

And this is where I'm struggling - coming up with the namespaces and abstracting the folder naming and getting mindset of not using DAL and BLL. So I'm thinking of the following going forward:

Solution name:
CompanyName.ProjectName

The data access layer (class library):
CompanyName.ProjectName.DataAccess

The business logic layer (class library)
CompanyName.ProjectName.BusinessLogic

Presentation Layer (web application)
CompanyName.ProjectName.Web

So far, so good I think? What I'm struggling with now though, is then grouping the code in the DataAccess layer and BusinessLogic layer. The web project will take care of itself as I've done those many many times.

If I was using a "Customer" and "Orders" as an example, should my folder structure/naming be like the following:

DataAcess:

Accessors (root folder name)
Customer (sub folder name)
CustomerAccessor.cs
Order (sub folder name)
OrderAccessor.cs


Business Logic:

Managers (root folder name)
Customer (sub folder name)
CustomerManager.cs
Order (sub folder name)
OrderManager.cs

Is this a good idea postfixing classes with Manager in the BLL and Accessor in the DAL? Or do any of you have any better naming conventions or folder structures to use?

Obviously I've done alot of reading around this and the above is the best I can come up with. But, any help or real world examples would be greatly appreciated in pointing me in the right direction.

It looks like a very subjective area but I'd like to get off to a good start which will obviously help long term in extending the project and making the code readable and managable
Cheers,
Elwappo
 
Old August 12th, 2011, 03:21 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Most of this makes a lot of sense. Personally, I wouldn't create that many folders if they only contain a few classes. You might as well store your OrderManager and the CustomerManager in the same folder. I typically divide them by type, rather than by what they represent (e.g. Interfaces, Collections, BaseTypes) and then have a Main folder for smaller projects, or various sub section related folders (e.g. your Customers and Orders folders if each of them contain a large number of files).

Cheers,
Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old August 12th, 2011, 04:24 PM
Authorized User
 
Join Date: Aug 2006
Posts: 41
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Imar View Post
Hi there,

Most of this makes a lot of sense. Personally, I wouldn't create that many folders if they only contain a few classes. You might as well store your OrderManager and the CustomerManager in the same folder. I typically divide them by type, rather than by what they represent (e.g. Interfaces, Collections, BaseTypes) and then have a Main folder for smaller projects, or various sub section related folders (e.g. your Customers and Orders folders if each of them contain a large number of files).

Cheers,
Imar
Thanks Imar,
And I think you're right about the folder structure - probably a bit too much. I think I'm gonna stick with "Mangers" and "Accessors" and then just group the classes under those. And then group other types under their respective folders as you suggest.

I've also had a thought that I could potentially end up with clashes if I've got a got a folder named the same as a class, so I'm going to keep it simple and readable.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about interface naming convention notig BOOK: Beginning Visual C# 2010 1 October 1st, 2010 08:21 AM
SQL Server Naming convention for Replication darrenb SQL Server 2005 3 May 3rd, 2008 02:50 PM
Table path using 4 part naming convention snufse SQL Server 2000 1 February 1st, 2008 07:45 PM
host has preset database naming convention crmpicco PHP Databases 0 October 23rd, 2007 01:14 PM
post xml data from ASP.NET app to ASP app polekat Classic ASP Professional 2 January 31st, 2007 08:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.