Code Structuring Guidelines for .net Projects

I usually use the IoC pattern in my projects, which are mostly ASP.net based. Are there any guidelines on how to structure projects in a common three-layer UI + BL + Data Access project. I want to know more about how to create folders where constants within each layer must be maintained (I store all strings like query string parameters, stored procedure parameter, etc. in a file named Constants, which is a singleton). How to create classes that interact with the data access layer from the business layer etc. and all such code structure issues.

Is there any guide or book on this?

+3


source to share


2 answers


Microsoft has a lot of information on this. I used Microsoft .NET: Enterprise Application Archiving as my bible for software architecture.

http://www.amazon.com/Microsoft%C2%AE-NET-Architecting-Applications-Pro-Developer/dp/073562609X

Check also MSDN manual

http://msdn.microsoft.com/en-us/library/ff647095.aspx



Also, see examples of some application frameworks like Sharp Architecture for examples

http://sharparchitecture.net/

Many NHibernate tutorials demonstrate software development principles that can be applied to any solution

http://nhforge.org/blogs/nhibernate/archive/2010/04/25/first-three-nhibernate-quickstart-tutorials-available.aspx

+2


source


@robbymurphy has a great answer. I would add that I keep most of the constants and interfaces in a separate project / assembly altogether. I call this my "main" assembly and define interfaces that allow me to pass data from the top of the stack to the bottom without tightly coupling them.

It's not much where they are used, but what purose is for. I once studied at a seminar where the instructor pounded "high cohesion, low cohesion" over and over again.



Store things that are in the real world together, but reduce dependencies between objects when possible.

This is a cohesion issue, and also a communication issue: if constants are indeed internal to the class, make them private static members (i.e., and an internal enumeration of states). If they are indeed internal to the project, create a class for them and make them internal (database constant in your data layer). Otherwise, place them in a public class in your own project.

0


source







All Articles