 |
| 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
|
|
|
|

August 11th, 2011, 05:45 PM
|
|
Authorized User
|
|
Join Date: Aug 2006
Posts: 41
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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
|
|

August 12th, 2011, 03:21 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

August 12th, 2011, 04:24 PM
|
|
Authorized User
|
|
Join Date: Aug 2006
Posts: 41
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Imar
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.
|
|
 |